Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NameResolver #267

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/erg_compiler/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ pub mod effectcheck;
pub mod error;
pub mod global;
pub mod hir;
pub mod index;
pub mod link;
pub mod linter;
pub mod lower;
pub mod mod_cache;
// pub mod name_resolve;
pub mod index;
pub mod name_resolve;
pub mod optimize;
pub mod ownercheck;
pub mod reorder;
Expand Down
2 changes: 2 additions & 0 deletions compiler/erg_compiler/name_resolve.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[derive(Debug)]
pub struct NameResolver {}
50 changes: 25 additions & 25 deletions doc/zh_CN/dev_guide/test.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# 测试
[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432)
测试是确保代码质量的重要部分
使用以下命令执行测试
``` sh
cargo test --features large_thread
```
由于cargo需要一个小线程来运行测试,我们使用 `large_thread` 标志来避免堆栈溢出
## 放置测试
根据实现的特性来安排它们。将解析器测试放置在`erg_parser/tests`下,将编译器(类型检查器等)测试放置在`erg_compiler/tests`下,将用户可以直接使用的语言特性测试放置在`erg/tests`下(然而,这些测试目前正在开发中,不一定按照这种惯例安排)
## 如何编写测试
有两种类型的测试。positive测试和negative测试。
positive测试是检查编译器是否按预期运行的测试,而negative测试是检查编译器是否正确地输出无效输入的错误。
由于编程语言处理器的性质,在所有软件中,它们特别容易受到无效输入的影响,并且必须始终将错误呈现给用户,因此后者也必须得到照顾。
如果你在语言中添加了一个新特性,你至少需要写一个positive测试。另外,如果可能的话,请写同时编写negative测试。
# 测试

[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432)

测试是确保代码质量的重要部分

使用以下命令执行测试

``` sh
cargo test --features large_thread
```

由于cargo需要一个小线程来运行测试,我们使用 `large_thread` 标志来避免堆栈溢出

## 放置测试

根据实现的特性来安排它们。将解析器测试放置在`erg_parser/tests`下,将编译器(类型检查器等)测试放置在`erg_compiler/tests`下,将用户可以直接使用的语言特性测试放置在`erg/tests`下(然而,这些测试目前正在开发中,不一定按照这种惯例安排)

## 如何编写测试

有两种类型的测试。positive测试和negative测试。
positive测试是检查编译器是否按预期运行的测试,而negative测试是检查编译器是否正确地输出无效输入的错误。
由于编程语言处理器的性质,在所有软件中,它们特别容易受到无效输入的影响,并且必须始终将错误呈现给用户,因此后者也必须得到照顾。

如果你在语言中添加了一个新特性,你至少需要写一个positive测试。另外,如果可能的话,请写同时编写negative测试。
50 changes: 25 additions & 25 deletions doc/zh_TW/dev_guide/test.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# 測試
[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432)
測試是確保代碼質量的重要部分
使用以下命令執行測試
``` sh
cargo test --features large_thread
```
由于cargo需要一個小線程來運行測試,我們使用 `large_thread` 標志來避免堆棧溢出
## 放置測試
根據實現的特性來安排它們。將解析器測試放置在`erg_parser/tests`下,將編譯器(類型檢查器等)測試放置在`erg_compiler/tests`下,將用戶可以直接使用的語言特性測試放置在`erg/tests`下(然而,這些測試目前正在開發中,不一定按照這種慣例安排)
## 如何編寫測試
有兩種類型的測試。positive測試和negative測試。
positive測試是檢查編譯器是否按預期運行的測試,而negative測試是檢查編譯器是否正確地輸出無效輸入的錯誤。
由于編程語言處理器的性質,在所有軟件中,它們特別容易受到無效輸入的影響,并且必須始終將錯誤呈現給用戶,因此后者也必須得到照顧。
如果你在語言中添加了一個新特性,你至少需要寫一個positive測試。另外,如果可能的話,請寫同時編寫negative測試。
# 測試

[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/test.md%26commit_hash%3D3e4251b9f9929891dd8ce422c1ed6853f77ab432)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/test.md&commit_hash=3e4251b9f9929891dd8ce422c1ed6853f77ab432)

測試是確保代碼質量的重要部分

使用以下命令執行測試

``` sh
cargo test --features large_thread
```

由于cargo需要一個小線程來運行測試,我們使用 `large_thread` 標志來避免堆棧溢出

## 放置測試

根據實現的特性來安排它們。將解析器測試放置在`erg_parser/tests`下,將編譯器(類型檢查器等)測試放置在`erg_compiler/tests`下,將用戶可以直接使用的語言特性測試放置在`erg/tests`下(然而,這些測試目前正在開發中,不一定按照這種慣例安排)

## 如何編寫測試

有兩種類型的測試。positive測試和negative測試。
positive測試是檢查編譯器是否按預期運行的測試,而negative測試是檢查編譯器是否正確地輸出無效輸入的錯誤。
由于編程語言處理器的性質,在所有軟件中,它們特別容易受到無效輸入的影響,并且必須始終將錯誤呈現給用戶,因此后者也必須得到照顧。

如果你在語言中添加了一個新特性,你至少需要寫一個positive測試。另外,如果可能的話,請寫同時編寫negative測試。