This commit is contained in:
Cai Bingjun 2022-09-11 20:53:52 +08:00
parent df77181e23
commit a9ea4eca75
137 changed files with 355 additions and 351 deletions

View file

@ -47,11 +47,11 @@
Traceback (most recent call last):
File "<stdin>", line 1, in <module
File "<stdin>", line 3, in g
類型錯誤只能將str(不是“int”)連接到str
類型錯誤只能將str(不是"int")連接到str
```
Erg 靜態檢查與父類的一致性。
重寫時必須給出“Override”裝飾器,并且重寫函數的類型必須是被重寫函數類型的子類型。
重寫時必須給出"Override"裝飾器,并且重寫函數的類型必須是被重寫函數類型的子類型。
```python
>>> C = Class()
@ -61,7 +61,7 @@ Erg 靜態檢查與父類的一致性。
>>> D = Inherit C
... .f self = "a"
...
錯誤[#XX]:文件<stdin>,第 5 行,在 D 中
錯誤[#XX]:文件"<stdin>",第 5 行,在 D 中
要覆蓋 f必須添加 `Override` 裝飾器,其類型必須是 `Self.() -> Nat` 或其子類型
f(self) 已在 C 中定義。要覆蓋 f必須添加 `Override` 裝飾器,其類型必須為 `Self. 要覆蓋,必須給它一個 `Override` 裝飾器,并且它的類型必須是 `Self.() -> Nat` 或 that.f(self) 的子類型。
```