diff --git a/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java b/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java index 9cfe433ae397..e66921b4ad00 100644 --- a/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java +++ b/python/src/com/jetbrains/python/codeInsight/PySubstitutionChunkReference.java @@ -321,14 +321,14 @@ public class PySubstitutionChunkReference extends PsiReferenceBase it instanceof PyStarExpression); + if (noElementsForSure) noElementsForSure = Arrays.stream(subsequenсeElements).noneMatch(it -> it instanceof PyStarExpression); seenElementsNumber += subsequenсeElements.length; } else { diff --git a/python/testData/inspections/PyStringFormatInspection/PackedListInsideList.py b/python/testData/inspections/PyStringFormatInspection/PackedListInsideList.py index 0480d0e0af22..ef083e68842e 100644 --- a/python/testData/inspections/PyStringFormatInspection/PackedListInsideList.py +++ b/python/testData/inspections/PyStringFormatInspection/PackedListInsideList.py @@ -1,2 +1,2 @@ "{3}".format(*[1, 2, *[3, 4]]) -"{4}".format(*[1, 2, *[3, 4]]) \ No newline at end of file +"{4}".format(*[1, 2, *[3, 4]]) \ No newline at end of file diff --git a/python/testData/inspections/PyStringFormatInspection/PackedListInsideTuple.py b/python/testData/inspections/PyStringFormatInspection/PackedListInsideTuple.py new file mode 100644 index 000000000000..b59b9b532997 --- /dev/null +++ b/python/testData/inspections/PyStringFormatInspection/PackedListInsideTuple.py @@ -0,0 +1,2 @@ +"{2}".format(*(1, 2, *[3, 4])) +"{4}".format(*(1, 2, *[3, 4])) \ No newline at end of file diff --git a/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideList.py b/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideList.py index 839ed648acf0..558a23337f46 100644 --- a/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideList.py +++ b/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideList.py @@ -1,2 +1,2 @@ "{3}".format(*[1, 2, *(3, 4)]) -"{4}".format(*[1, 2, *(3, 4)]) \ No newline at end of file +"{4}".format(*[1, 2, *(3, 4)]) \ No newline at end of file diff --git a/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideTuple.py b/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideTuple.py index ba38f6cc248b..9727e7906853 100644 --- a/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideTuple.py +++ b/python/testData/inspections/PyStringFormatInspection/PackedTupleInsideTuple.py @@ -1,2 +1,2 @@ "{3}".format(*(1, 2, *(3, 4))) -"{4}".format(*(1, 2, *(3, 4))) \ No newline at end of file +"{4}".format(*(1, 2, *(3, 4))) \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/inspections/Py3StringFormatInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/Py3StringFormatInspectionTest.java index df95fd0c0280..ef2b4ebabd64 100644 --- a/python/testSrc/com/jetbrains/python/inspections/Py3StringFormatInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/Py3StringFormatInspectionTest.java @@ -65,6 +65,9 @@ public class Py3StringFormatInspectionTest extends PyTestCase { runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest); } + public void testPackedListInsideTuple() { + runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest); + } private void doTest() { myFixture.configureByFile(TEST_DIRECTORY + getTestName(false) + ".py");