mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-02 10:13:22 +08:00
typehints for variables in comments
This commit is contained in:
@@ -157,27 +157,3 @@ Y = int
|
||||
def just_because_we_can(x: "flo" + "at"):
|
||||
#? float()
|
||||
x
|
||||
|
||||
# python >= 2.6
|
||||
|
||||
x = 3 # type: str
|
||||
#? str()
|
||||
x
|
||||
|
||||
y = 3 # type: str but I write more
|
||||
#? int()
|
||||
y
|
||||
|
||||
z = 3 # type: str # I comment more
|
||||
#? str()
|
||||
z
|
||||
|
||||
class BB: pass
|
||||
|
||||
def test(a, b):
|
||||
a = a # type: BB
|
||||
c = a # type: str
|
||||
#? BB()
|
||||
a
|
||||
#? str()
|
||||
c
|
||||
|
||||
39
test/completion/pep0484_comments.py
Normal file
39
test/completion/pep0484_comments.py
Normal file
@@ -0,0 +1,39 @@
|
||||
a = 3 # type: str
|
||||
#? str()
|
||||
a
|
||||
|
||||
b = 3 # type: str but I write more
|
||||
#? int()
|
||||
b
|
||||
|
||||
c = 3 # type: str # I comment more
|
||||
#? str()
|
||||
c
|
||||
|
||||
d = "It should not read comments from the next line"
|
||||
# type: int
|
||||
#? str()
|
||||
d
|
||||
|
||||
# type: int
|
||||
e = "It should not read comments from the previous line"
|
||||
#? str()
|
||||
e
|
||||
|
||||
class BB: pass
|
||||
|
||||
def test(a, b):
|
||||
a = a # type: BB
|
||||
c = a # type: str
|
||||
d = a
|
||||
# type: str
|
||||
e = a # type: str # Should ignore long whitespace
|
||||
|
||||
#? BB()
|
||||
a
|
||||
#? str()
|
||||
c
|
||||
#? BB()
|
||||
d
|
||||
#? str()
|
||||
e
|
||||
Reference in New Issue
Block a user