PY-35624 Don't suggest renaming magic literals for any part of an f-string
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Sun, 9 Aug 2020 13:43:14 +0000 (16:43 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Mon, 10 Aug 2020 16:03:10 +0000 (16:03 +0000)
commit3e95076004c8d4db14181dacaf9173787fd71376
treed3fccac11c52e98d859a933e854fdff5b9c5cae1
parentde05a06ca37109ebfa35e2e7dbb0596342e549a9
PY-35624 Don't suggest renaming magic literals for any part of an f-string

Since, in general, the exact value of such literals can't be known statically,
hence it's just not safe to base a refactoring on them.

I've introduced a new method PyStringLiteralExpression#isInterpolated that
detects whether a literal contains any embedded expressions. It might be
useful in other actions that don't properly take f-strings into account yet.

GitOrigin-RevId: 73ee91a175399576a751d3ec4b590a2e7f171e67
python/python-psi-api/src/com/jetbrains/python/psi/PyStringLiteralExpression.java
python/python-psi-impl/src/com/jetbrains/python/psi/impl/PyStringLiteralExpressionImpl.java
python/src/com/jetbrains/python/magicLiteral/PyMagicLiteralRenameHandler.java
python/testSrc/com/jetbrains/python/PyStringLiteralTest.java