mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
trifle
This commit is contained in:
parent
a162001c6f
commit
2ecd249a2a
8 changed files with 8 additions and 8 deletions
|
@ -59,7 +59,7 @@ The `Override` decorator must be given when overriding, and the type of the over
|
|||
>>> D = Inherit C
|
||||
... .f self = "a"
|
||||
...
|
||||
Error[# XX]: File "<stdin>", line 5, in D
|
||||
Error[#XX]: File "<stdin>", line 5, in D
|
||||
To override f, it must be added `Override` decorator and its type must be `Self.() -> Nat` or the subtype of that
|
||||
f(self) is already defined in C. To override f, it must be added `Override` decorator and its type must be `Self. To override, it must be given an `Override` decorator and its type must be `Self.() -> Nat` or the subtype of that.f(self).
|
||||
```
|
||||
|
|
|
@ -26,7 +26,7 @@ If you do not want to allow these implicit type conversions, you can specify the
|
|||
a = 1
|
||||
b: Int = a / 2
|
||||
# error message
|
||||
Error[# 0047]: File <stdin>, line 1, in <module>
|
||||
Error[#0047]: File <stdin>, line 1, in <module>
|
||||
2│ b: Int = int / 2
|
||||
^
|
||||
TypeError: the type of ratio is mismatched:
|
||||
|
|
|
@ -61,7 +61,7 @@ Ergでは親クラスとの整合性が静的に検査される。
|
|||
>>> D = Inherit C
|
||||
... .f self = "a"
|
||||
...
|
||||
Error[# XX]: File "<stdin>", line 5, in D
|
||||
Error[#XX]: File "<stdin>", line 5, in D
|
||||
.f(self) is already defined in C. To override f, it must be added `Override` decorator and its type must be `Self.() -> Nat` or the subtype of that
|
||||
.f(self)は既にCで定義されています。オーバーライドするためには`Override`デコレータを付与し、`Self.() -> Nat`型かそのサブタイプである必要があります。
|
||||
```
|
||||
|
|
|
@ -28,7 +28,7 @@ e = f // 2 # 0: Nat(Int)
|
|||
a = 1
|
||||
b: Int = a / 2
|
||||
# error message
|
||||
Error[# 0047]: File <stdin>, line 1, in <module>
|
||||
Error[#0047]: File <stdin>, line 1, in <module>
|
||||
2│ b: Int = int / 2
|
||||
^
|
||||
TypeError: the type of ratio is mismatched:
|
||||
|
|
|
@ -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) 的子类型
|
||||
```
|
||||
|
|
|
@ -28,7 +28,7 @@ e = f // 2 # 0: Nat
|
|||
a = 1
|
||||
b: Int = a / 2
|
||||
# 错误信息
|
||||
Error[# 0047]: File <stdin>, line 1, in <module>
|
||||
Error[#0047]: File <stdin>, line 1, in <module>
|
||||
2│ b: Int = int / 2
|
||||
^
|
||||
类型错误: ratio的类型不匹配:
|
||||
|
|
|
@ -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) 的子類型
|
||||
```
|
||||
|
|
|
@ -28,7 +28,7 @@ e = f // 2 # 0: Nat
|
|||
a = 1
|
||||
b: Int = a / 2
|
||||
# 錯誤信息
|
||||
Error[# 0047]: File <stdin>, line 1, in <module>
|
||||
Error[#0047]: File <stdin>, line 1, in <module>
|
||||
2│ b: Int = int / 2
|
||||
^
|
||||
類型錯誤: ratio的類型不匹配:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue