don't highlight dict comprehensions as unsupported in Python 2.7

This commit is contained in:
Dmitry Jemerov
2010-07-05 21:20:24 +04:00
parent 7a8df8fa22
commit c95ef5d111
2 changed files with 6 additions and 3 deletions
@@ -49,8 +49,11 @@ public class UnsupportedFeatures extends PyAnnotator {
@Override
public void visitPyDictCompExpression(PyDictCompExpression node) {
super.visitPyDictCompExpression(node);
if (isPy2(node)) {
getHolder().createWarningAnnotation(node, "Dictionary comprehension is not supported in Python 2").registerFix(new ConvertDictCompIntention());
LanguageLevel languageLevel = getLanguageLevel(node);
if (!languageLevel.supportsSetLiterals()) {
getHolder()
.createWarningAnnotation(node, "Python version " + languageLevel + " does not support dictionary comprehensions")
.registerFix(new ConvertDictCompIntention());
}
}
@@ -1,6 +1,6 @@
from __future__ import with_statement
<warning descr="Dictionary comprehension is not supported in Python 2">{k: v for k, v in stuff}</warning>
<warning descr="Python version 2.5 does not support dictionary comprehensions">{k: v for k, v in stuff}</warning>
try:
pass