mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-15 10:07:06 +08:00
Fix: Set/Dict Comprehensions don't raise an error. They are just ignored for now.
This commit is contained in:
@@ -339,6 +339,9 @@ class Evaluator(object):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if isinstance(comp_for, tree.CompFor):
|
if isinstance(comp_for, tree.CompFor):
|
||||||
|
if atom.children[0] == '{':
|
||||||
|
# TODO dict/set comprehensions should be working.
|
||||||
|
return []
|
||||||
return set([iterable.Comprehension.from_atom(self, atom)])
|
return set([iterable.Comprehension.from_atom(self, atom)])
|
||||||
return set([iterable.Array(self, atom)])
|
return set([iterable.Array(self, atom)])
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ left
|
|||||||
#? str()
|
#? str()
|
||||||
[a for a in {1:'x'}][0]
|
[a for a in {1:'x'}][0]
|
||||||
|
|
||||||
##? str()
|
|
||||||
{a-1:b for a,b in {1:'a', 3:1.0}.items()}[0]
|
|
||||||
|
|
||||||
# list comprehensions should also work in combination with functions
|
# list comprehensions should also work in combination with functions
|
||||||
def listen(arg):
|
def listen(arg):
|
||||||
for x in arg:
|
for x in arg:
|
||||||
@@ -118,6 +115,16 @@ left
|
|||||||
#? int()
|
#? int()
|
||||||
right
|
right
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# set comprehensions
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
##? str()
|
||||||
|
{a - 1: b for a, b in {1: 'a', 3: 1.0}.items()}[0]
|
||||||
|
|
||||||
|
#?
|
||||||
|
{a - 1 for a in [1]}
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# name resolution in comprehensions.
|
# name resolution in comprehensions.
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -127,3 +134,5 @@ def x():
|
|||||||
#? 22
|
#? 22
|
||||||
[a for a in h if hio]
|
[a for a in h if hio]
|
||||||
if hio: pass
|
if hio: pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user