mirror of https://github.com/mtshiba/pylyzer
support unary operator checks
This commit is contained in:
parent
4b3ff53295
commit
80249587eb
|
|
@ -253,7 +253,7 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
|||
[[package]]
|
||||
name = "els"
|
||||
version = "0.1.18"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=py-structural#5cddba369e9124f846348e0a690d3b84b252366a"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=main#f604338d996fdee827c51386e23b26b6c0159389"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"erg_compiler",
|
||||
|
|
@ -274,7 +274,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "erg_common"
|
||||
version = "0.6.6"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=py-structural#5cddba369e9124f846348e0a690d3b84b252366a"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=main#f604338d996fdee827c51386e23b26b6c0159389"
|
||||
dependencies = [
|
||||
"backtrace-on-stack-overflow",
|
||||
"hermit-abi",
|
||||
|
|
@ -285,7 +285,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "erg_compiler"
|
||||
version = "0.6.6"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=py-structural#5cddba369e9124f846348e0a690d3b84b252366a"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=main#f604338d996fdee827c51386e23b26b6c0159389"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"erg_parser",
|
||||
|
|
@ -294,7 +294,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "erg_parser"
|
||||
version = "0.6.6"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=py-structural#5cddba369e9124f846348e0a690d3b84b252366a"
|
||||
source = "git+https://github.com/erg-lang/erg?branch=main#f604338d996fdee827c51386e23b26b6c0159389"
|
||||
dependencies = [
|
||||
"erg_common",
|
||||
"unicode-xid 0.2.4",
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ repository = "https://github.com/mtshiba/pylyzer"
|
|||
# erg_compiler = { version = "0.6.5-nightly.1", features = ["py_compatible", "els"] }
|
||||
# els = { version = "0.1.17-nightly.1", features = ["py_compatible"] }
|
||||
rustpython-parser = "0.1.2"
|
||||
erg_compiler = { git = "https://github.com/erg-lang/erg", branch = "py-structural", features = ["py_compatible", "els"] }
|
||||
erg_common = { git = "https://github.com/erg-lang/erg", branch = "py-structural", features = ["py_compatible", "els"] }
|
||||
els = { git = "https://github.com/erg-lang/erg", branch = "py-structural", features = ["py_compatible"] }
|
||||
erg_compiler = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compatible", "els"] }
|
||||
erg_common = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compatible", "els"] }
|
||||
els = { git = "https://github.com/erg-lang/erg", branch = "main", features = ["py_compatible"] }
|
||||
|
||||
[features]
|
||||
debug = ["erg_compiler/debug", "erg_common/debug", "py2erg/debug"]
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ class D:
|
|||
return D(self.c + other.c)
|
||||
def __sub__(self, other: C):
|
||||
return D(self.c - other.x)
|
||||
def __neg__(self):
|
||||
return D(-self.c)
|
||||
def __init__(self, c):
|
||||
self.c = c
|
||||
|
||||
|
|
@ -41,3 +43,4 @@ c1 = D(1).c + 1
|
|||
d = D(1) + D(2)
|
||||
err = C(1, 2) + D(1) # ERR
|
||||
ok = D(1) - C(1, 2) # OK
|
||||
c = -d # OK
|
||||
|
|
|
|||
Loading…
Reference in New Issue