From bea228fcd7c6ad596b95a9da839fa9c5e4f9b380 Mon Sep 17 00:00:00 2001 From: Valentina Kiryushkina Date: Wed, 25 May 2016 18:01:45 +0300 Subject: [PATCH] Fix false positive in format inspection: check compatibility for primitive types only --- .../inspections/PyStringFormatInspection.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java b/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java index d0b6d22c2c9c..fbc70e9fbdf7 100644 --- a/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java @@ -449,10 +449,9 @@ public class PyStringFormatInspection extends PyInspection { } } - private int inspectNewStyleArgumentForChunk(int i, - @NotNull PyStringFormatParser.NewStyleSubstitutionChunk chunk, - @NotNull String mappingKey, @NotNull PyStringLiteralExpression formatExpression) { - int arguments = 0; + private void inspectNewStyleArgumentForChunk(int i, + @NotNull PyStringFormatParser.NewStyleSubstitutionChunk chunk, + @NotNull String mappingKey, @NotNull PyStringLiteralExpression formatExpression) { final PsiElement resolve = new PySubstitutionChunkReference(formatExpression, chunk, i).resolve(); if (resolve == null) { final String chunkMapping = chunk.getMappingKey(); @@ -476,9 +475,7 @@ public class PyStringFormatInspection extends PyInspection { } } } - arguments++; } - return arguments; } private String inspectNewStyleChunk(@NotNull PyStringLiteralExpression formatExpression, @@ -607,11 +604,7 @@ public class PyStringFormatInspection extends PyInspection { final PyStringLiteralExpression literalExpression = PsiTreeUtil.getChildOfType(callee, PyStringLiteralExpression.class); if (literalExpression != null) { final Inspection inspection = new Inspection(this, myTypeEvalContext); - final PyArgumentList list = node.getArgumentList(); - - if (list != null) { - inspection.inspectNewStyleValues(literalExpression); - } + inspection.inspectNewStyleValues(literalExpression); } } }