mirror of https://github.com/mtshiba/pylyzer
Add error documents
This commit is contained in:
parent
f46b33d243
commit
c3c1615690
|
|
@ -5,7 +5,6 @@ use erg_compiler::error::CompileError;
|
||||||
|
|
||||||
pub(crate) fn reassign_func_error(
|
pub(crate) fn reassign_func_error(
|
||||||
input: Input,
|
input: Input,
|
||||||
errno: usize,
|
|
||||||
loc: Location,
|
loc: Location,
|
||||||
caused_by: String,
|
caused_by: String,
|
||||||
name: &str,
|
name: &str,
|
||||||
|
|
@ -19,7 +18,7 @@ pub(crate) fn reassign_func_error(
|
||||||
"traditional_chinese" => format!("{name}已宣告,已被引用。不建議再次賦值"),
|
"traditional_chinese" => format!("{name}已宣告,已被引用。不建議再次賦值"),
|
||||||
"english" => format!("{name} has already been declared and referenced. It is not recommended to reassign such a function"),
|
"english" => format!("{name} has already been declared and referenced. It is not recommended to reassign such a function"),
|
||||||
),
|
),
|
||||||
errno,
|
1,
|
||||||
ErrorKind::AssignError,
|
ErrorKind::AssignError,
|
||||||
loc,
|
loc,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Pylyzer-specific errors
|
||||||
|
|
||||||
|
## E0001: Reassignment of a function referenced by other functions
|
||||||
|
|
||||||
|
```python
|
||||||
|
def g(): return f()
|
||||||
|
|
||||||
|
def f(): return 1
|
||||||
|
def f(): return "a" # E0001: Reassignment of a function referenced by other functions
|
||||||
|
|
||||||
|
print(g())
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue