diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java index 61bdc7e032eb..c3b119287730 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java @@ -81,8 +81,8 @@ public class PyDictConstructorToLiteralFormIntention extends BaseIntentionAction } } - PyExpressionStatement dict = elementGenerator.createFromText(LanguageLevel.forElement(expression), PyExpressionStatement.class, - "{" + stringBuilder.toString() + "}"); + PyDictLiteralExpression dict = (PyDictLiteralExpression)elementGenerator.createFromText(LanguageLevel.forElement(expression), PyExpressionStatement.class, + "{" + stringBuilder.toString() + "}").getExpression(); expression.replace(dict); } } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java index b4363939cc42..e32388fc47c2 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java @@ -126,8 +126,8 @@ public class PyDictLiteralFormToConstructorIntention extends BaseIntentionAction } } stringBuilder.append(")"); - PyStatement callExpression = elementGenerator.createFromText(LanguageLevel.forElement(dictExpression), - PyStatement.class, stringBuilder.toString()); + PyCallExpression callExpression = (PyCallExpression)elementGenerator.createFromText(LanguageLevel.forElement(dictExpression), + PyExpressionStatement.class, stringBuilder.toString()).getExpression(); dictExpression.replace(callExpression); } }