mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't highlight dict comprehensions as unsupported in Python 2.7
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user