diff --git a/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties b/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties
index 6cd31c56f5e9..329dfb6cee07 100644
--- a/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties
+++ b/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties
@@ -2285,6 +2285,8 @@ inspection.remove.setter.parameter.type.display.name=Redundant setter parameter
inspection.convert.reference.to.lambda.display.name=Can be replaced with lambda
inspection.convert.lambda.to.reference.display.name=Can be replaced with function reference
inspection.can.be.primary.constructor.property.display.name=Property is explicitly assigned to constructor parameter
+inspection.can.unescape.dollar.literal.inspection.display.name=Escaped dollar characters in the string can be simplified
+replace.with.dollar.literals=Replace escaped dollars with literals
inspection.has.platform.type.display.name=Function or property has platform type
inspection.leaking.this.display.name=Leaking 'this' in constructor
inspection.redundant.if.display.name=Redundant 'if' statement
diff --git a/plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/CanUnescapeDollarLiteral.html b/plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/CanUnescapeDollarLiteral.html
new file mode 100644
index 000000000000..73b97709c0c2
--- /dev/null
+++ b/plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/CanUnescapeDollarLiteral.html
@@ -0,0 +1,21 @@
+
+
+Reports that escaped dollar characters in a string can be replaced with regular literals.
+
+ Escaping is only necessary when string content after dollar can be misinterpreted as a string interpolation entry.
+
+Example:
+
+ fun example() {
+ "The price today is \$10. The price tomorrow will be ${'$'}20."
+ }
+
+The quick fix converts all safely replaceable escaped dollar characters to regular dollar characters:
+
+ fun example() {
+ "The price today is $10. The price tomorrow will be $20."
+ }
+
+
+
+
\ No newline at end of file
diff --git a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeinsights/impl/base/PrefixedStringTemplateUtils.kt b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeinsights/impl/base/PrefixedStringTemplateUtils.kt
index e2df171d2d0b..ee699f43568a 100644
--- a/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeinsights/impl/base/PrefixedStringTemplateUtils.kt
+++ b/plugins/kotlin/code-insight/impl-base/src/org/jetbrains/kotlin/idea/codeinsights/impl/base/PrefixedStringTemplateUtils.kt
@@ -16,8 +16,6 @@ val dollarLiteralExpressions: Array = arrayOf(
"'$'", "\"$\""
)
-private object PrefixedStringTemplateUtils
-
/**
* Convert this string template to a new one with the specified interpolation prefix length.
* The content of the template does not change.
@@ -67,7 +65,7 @@ fun KtStringTemplateExpression.changeInterpolationPrefix(
if (isDestinationSingleQuoted) {
factory.createStringTemplate(contentText)
} else {
- // hack until KtPsiFactory has a triple-quoted template generation
+ // hack until KtPsiFactory has a triple-quoted template generation, KTIJ-31681
factory.createExpression("\"\"\"$contentText\"\"\"") as KtStringTemplateExpression
}
} else {
@@ -250,7 +248,24 @@ fun KtStringTemplateEntry.unescapeIfPossible(newPrefixLength: Int): KtStringTemp
* println("\$`"); println("`")
* ```
*/
-fun KtLiteralStringTemplateEntry.canBeConsideredIdentifierOrBlock(): Boolean {
- val firstChar = text.firstOrNull() ?: return false
- return firstChar.isLetter() || firstChar == '_' || firstChar == '{' || firstChar == '`'
+fun KtLiteralStringTemplateEntry.canBeConsideredIdentifierOrBlock(): Boolean =
+ text.firstOrNull()?.canBeStartOfIdentifierOrBlock() == true
+
+fun Char.canBeStartOfIdentifierOrBlock(): Boolean {
+ @Suppress("KotlinConstantConditions") // K2 inspection false positive, `isLetter` returns false for these chars KTIJ-31678
+ return isLetter() || this == '_' || this == '{' || this == '`'
+}
+
+fun KtStringTemplateEntry.isEscapedDollar(): Boolean {
+ return when (this) {
+ is KtEscapeStringTemplateEntry -> {
+ return unescapedValue == "$"
+ }
+
+ is KtBlockStringTemplateEntry -> {
+ expression?.text in dollarLiteralExpressions
+ }
+
+ else -> false
+ }
}
diff --git a/plugins/kotlin/code-insight/inspections-k2/resources/kotlin.code-insight.inspections.k2.xml b/plugins/kotlin/code-insight/inspections-k2/resources/kotlin.code-insight.inspections.k2.xml
index 9bead6e51a2c..2864e48ea1cd 100644
--- a/plugins/kotlin/code-insight/inspections-k2/resources/kotlin.code-insight.inspections.k2.xml
+++ b/plugins/kotlin/code-insight/inspections-k2/resources/kotlin.code-insight.inspections.k2.xml
@@ -60,6 +60,14 @@
language="kotlin"
key="inspection.can.be.primary.constructor.property.display.name" bundle="messages.KotlinBundle"/>
+
+
() {
+ class Context(
+ val oldText: String,
+ val indicesToReplace: Set,
+ )
+
+ override fun getProblemDescription(
+ element: KtStringTemplateExpression,
+ context: Context,
+ ): @InspectionMessage String {
+ return KotlinBundle.message("inspection.can.unescape.dollar.literal.inspection.display.name")
+ }
+
+ override fun createQuickFix(
+ element: KtStringTemplateExpression,
+ context: Context,
+ ): KotlinModCommandQuickFix = object : KotlinModCommandQuickFix() {
+ override fun getFamilyName(): @IntentionFamilyName String {
+ return KotlinBundle.message("replace.with.dollar.literals")
+ }
+
+ override fun applyFix(
+ project: Project,
+ element: KtStringTemplateExpression,
+ updater: ModPsiUpdater,
+ ) {
+ val prefixLength = element.interpolationPrefix?.textLength ?: 0
+ if (element.text != context.oldText) return
+
+ val psiFactory = KtPsiFactory(project)
+ for (entryIndexToReplace in context.indicesToReplace) {
+ element.entries[entryIndexToReplace].replace(psiFactory.createLiteralStringTemplateEntry("$"))
+ }
+ val updatedTemplateText = element.entries.joinToString("") { it.text }
+ val recreatedTemplate = createReplacementTemplate(
+ psiFactory, updatedTemplateText, prefixLength,
+ isSingleQuoted = element.isSingleQuoted(),
+ )
+ element.replace(recreatedTemplate)
+ }
+
+ private fun createReplacementTemplate(
+ ktPsiFactory: KtPsiFactory,
+ updatedTemplateText: String,
+ prefixLength: Int,
+ isSingleQuoted: Boolean,
+ ): KtStringTemplateExpression {
+ return when {
+ prefixLength > 0 -> {
+ ktPsiFactory.createMultiDollarStringTemplate(updatedTemplateText, prefixLength, forceMultiQuoted = !isSingleQuoted)
+ }
+
+ else -> {
+ if (isSingleQuoted) {
+ ktPsiFactory.createStringTemplate(updatedTemplateText)
+ } else {
+ // KTIJ-31681
+ val quote = "\"\"\""
+ ktPsiFactory.createExpression("$quote$updatedTemplateText$quote") as KtStringTemplateExpression
+ }
+ }
+ }
+ }
+ }
+
+ override fun isApplicableByPsi(element: KtStringTemplateExpression): Boolean {
+ return element.interpolationPrefix?.textLength?.let { it > 1 } != true
+ || element.languageVersionSettings.supportsFeature(LanguageFeature.MultiDollarInterpolation)
+ }
+
+ override fun buildVisitor(
+ holder: ProblemsHolder,
+ isOnTheFly: Boolean,
+ ): KtVisitor<*, *> {
+ return object : KtVisitorVoid() {
+ override fun visitStringTemplateExpression(entry: KtStringTemplateExpression) {
+ visitTargetElement(entry, holder, isOnTheFly)
+ }
+ }
+ }
+
+ /**
+ * Find indices of replaceable entries in a string.
+ * Going through the string entries, count sequential dollars and keep indices of potentially replaceable entries.
+ * If the length exceeds `prefixLength - 1`, don't add the index of the last entry as replacing it will change the string.
+ * However, it's still safe to replace all the dollars before the unsafe one.
+ */
+ context(KaSession)
+ override fun prepareContext(element: KtStringTemplateExpression): Context? {
+ val prefixLength = element.interpolationPrefix?.textLength ?: 0
+ var sequentialDollarsCounter = 0
+ val confirmedReplaceableIndices = mutableSetOf()
+ val candidateReplaceableIndices = mutableListOf()
+ for ((entryIndex, entry) in element.entries.withIndex()) {
+ if (entry.isEscapedDollar()) {
+ candidateReplaceableIndices.add(entryIndex)
+ sequentialDollarsCounter++
+ } else if (entry is KtLiteralStringTemplateEntry) {
+ val lastDollarsCount = entry.text.takeLastWhile { it == '$' }.count()
+ if (lastDollarsCount == entry.text.length) {
+ // if the whole line is $, add its length to the previous result
+ sequentialDollarsCounter += entry.text.length
+ } else {
+ // The chain of dollars ended. Check the beginning for $, then the first character after for being unsafe.
+ val firstDollarsCount = entry.text.takeWhile { it == '$' }.count()
+ sequentialDollarsCounter += firstDollarsCount
+ val isSafe = sequentialDollarsCounter < prefixLength
+ || entry.text.getOrNull(firstDollarsCount)?.canBeStartOfIdentifierOrBlock() != true
+
+ if (isSafe) {
+ confirmedReplaceableIndices.addAll(candidateReplaceableIndices)
+ } else if (candidateReplaceableIndices.isNotEmpty()) {
+ confirmedReplaceableIndices.addAll(candidateReplaceableIndices.dropLast(1))
+ }
+
+ candidateReplaceableIndices.clear()
+ sequentialDollarsCounter = lastDollarsCount
+ }
+ } else if (sequentialDollarsCounter > 0) {
+ confirmedReplaceableIndices.addAll(candidateReplaceableIndices)
+ candidateReplaceableIndices.clear()
+ sequentialDollarsCounter = 0
+ }
+ }
+ // A template can end with several replaceable dollars.
+ // Add the accumulated indices, it's safe to replace the corresponding entries — there is nothing after them.
+ confirmedReplaceableIndices.addAll(candidateReplaceableIndices)
+ return Context(element.text, confirmedReplaceableIndices).takeIf { confirmedReplaceableIndices.isNotEmpty() }
+ }
+}
diff --git a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2LocalInspectionTestGenerated.java b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2LocalInspectionTestGenerated.java
index af401b3b5455..3cf1075f09a6 100644
--- a/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2LocalInspectionTestGenerated.java
+++ b/plugins/kotlin/code-insight/inspections-k2/tests/test/org/jetbrains/kotlin/idea/k2/inspections/tests/K2LocalInspectionTestGenerated.java
@@ -8028,6 +8028,230 @@ public abstract class K2LocalInspectionTestGenerated extends AbstractK2LocalInsp
}
}
+ @RunWith(JUnit3RunnerWithInners.class)
+ @TestMetadata("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral")
+ public static class CanSimplifyDollarLiteral extends AbstractK2LocalInspectionTest {
+ @java.lang.Override
+ @org.jetbrains.annotations.NotNull
+ public final KotlinPluginMode getPluginMode() {
+ return KotlinPluginMode.K2;
+ }
+
+ private void runTest(String testDataFilePath) throws Exception {
+ KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
+ }
+
+ @TestMetadata("beforeAndAfterBlockExpression.kt")
+ public void testBeforeAndAfterBlockExpression() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt");
+ }
+
+ @TestMetadata("beforeAndAfterEscapeSequence.kt")
+ public void testBeforeAndAfterEscapeSequence() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt");
+ }
+
+ @TestMetadata("beforeAndAfterSimpleNameExpression.kt")
+ public void testBeforeAndAfterSimpleNameExpression() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt");
+ }
+
+ @TestMetadata("blockSlashEscapeOnlyFirst.kt")
+ public void testBlockSlashEscapeOnlyFirst() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt");
+ }
+
+ @TestMetadata("blockSlashEscapingMixed.kt")
+ public void testBlockSlashEscapingMixed() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt");
+ }
+
+ @TestMetadata("canEscapeAllBeforeNumber.kt")
+ public void testCanEscapeAllBeforeNumber() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt");
+ }
+
+ @TestMetadata("multipleBlockEscapedDollars.kt")
+ public void testMultipleBlockEscapedDollars() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt");
+ }
+
+ @TestMetadata("multipleSlashEscapedDollars.kt")
+ public void testMultipleSlashEscapedDollars() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt");
+ }
+
+ @TestMetadata("noPrefixSimplifiableBeforeBlockExpression.kt")
+ public void testNoPrefixSimplifiableBeforeBlockExpression() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscape.kt")
+ public void testNoPrefixSingleQuoteBlockEscape() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeBeforeBacktick() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeBeforeLetter.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeBeforeLetter() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeBeforeUnderscore() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeNoReplacement.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeNoReplacement() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeNoReplacement.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteMultipleReplacements.kt")
+ public void testNoPrefixSingleQuoteMultipleReplacements() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscape.kt")
+ public void testNoPrefixSingleQuoteSlashEscape() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeBeforeBackticks() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeBeforeLetter.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeBeforeLetter() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeBeforeUnderscore() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeNoReplacement.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeNoReplacement() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeNoReplacement.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuote.kt")
+ public void testNoPrefixTripleQuote() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeBacktick.kt")
+ public void testNoPrefixTripleQuoteBeforeBacktick() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeBlock.kt")
+ public void testNoPrefixTripleQuoteBeforeBlock() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeLetter.kt")
+ public void testNoPrefixTripleQuoteBeforeLetter() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeUnderscore.kt")
+ public void testNoPrefixTripleQuoteBeforeUnderscore() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteMultipleReplacements.kt")
+ public void testNoPrefixTripleQuoteMultipleReplacements() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteNonEscapingBackslashes.kt")
+ public void testNoPrefixTripleQuoteNonEscapingBackslashes() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteNonEscapingBackslashes.kt");
+ }
+
+ @TestMetadata("notApplicableBacktickIdentifier.kt")
+ public void testNotApplicableBacktickIdentifier() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBacktickIdentifier.kt");
+ }
+
+ @TestMetadata("notApplicableBlockEscapedAfterDollar.kt")
+ public void testNotApplicableBlockEscapedAfterDollar() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedAfterDollar.kt");
+ }
+
+ @TestMetadata("notApplicableBlockEscapedBeforeDollar.kt")
+ public void testNotApplicableBlockEscapedBeforeDollar() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedBeforeDollar.kt");
+ }
+
+ @TestMetadata("notApplicableCurlyBraces.kt")
+ public void testNotApplicableCurlyBraces() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableCurlyBraces.kt");
+ }
+
+ @TestMetadata("notApplicableSlashEscapedAfterDollar.kt")
+ public void testNotApplicableSlashEscapedAfterDollar() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedAfterDollar.kt");
+ }
+
+ @TestMetadata("notApplicableSlashEscapedBeforeDollar.kt")
+ public void testNotApplicableSlashEscapedBeforeDollar() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedBeforeDollar.kt");
+ }
+
+ @TestMetadata("notApplicableUnderscoredIdentifier.kt")
+ public void testNotApplicableUnderscoredIdentifier() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableUnderscoredIdentifier.kt");
+ }
+
+ @TestMetadata("prefix4Safe.kt")
+ public void testPrefix4Safe() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt");
+ }
+
+ @TestMetadata("prefix4SafeLong.kt")
+ public void testPrefix4SafeLong() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt");
+ }
+
+ @TestMetadata("prefix4Unsafe.kt")
+ public void testPrefix4Unsafe() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Unsafe.kt");
+ }
+
+ @TestMetadata("singleBlockEscapedDollar.kt")
+ public void testSingleBlockEscapedDollar() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt");
+ }
+
+ @TestMetadata("singleDollarPrefixSingleQuoteMultipleReplacements.kt")
+ public void testSingleDollarPrefixSingleQuoteMultipleReplacements() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("singleDollarPrefixTripleQuoteMultipleReplacements.kt")
+ public void testSingleDollarPrefixTripleQuoteMultipleReplacements() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("singleSlashEscapedDollar.kt")
+ public void testSingleSlashEscapedDollar() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt");
+ }
+
+ @TestMetadata("slashBlockEscapeOnlyFirst.kt")
+ public void testSlashBlockEscapeOnlyFirst() throws Exception {
+ runTest("../../../idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt");
+ }
+ }
+
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("testData/inspectionsLocal")
public abstract static class InspectionsLocal extends AbstractK2LocalInspectionTest {
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt
index 90fb686c58b4..30807eeb5eb6 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/AbstractLocalInspectionTest.kt
@@ -83,6 +83,8 @@ abstract class AbstractLocalInspectionTest : KotlinLightCodeInsightFixtureTestCa
}
val className = FileUtil.loadFile(candidateFiles[0]).trim { it <= ' ' }
+ if (className.isBlank()) return object : LocalInspectionTool() {} // return a stub inspection if K1 is not supported
+
return Class.forName(className).getDeclaredConstructor().newInstance() as LocalInspectionTool
}
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
index d395879228bd..a2b8e601f2c5 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
@@ -1316,6 +1316,230 @@ public abstract class LocalInspectionTestGenerated extends AbstractLocalInspecti
}
}
+ @RunWith(JUnit3RunnerWithInners.class)
+ @TestMetadata("testData/inspectionsLocal/canSimplifyDollarLiteral")
+ public static class CanSimplifyDollarLiteral extends AbstractLocalInspectionTest {
+ @java.lang.Override
+ @org.jetbrains.annotations.NotNull
+ public final KotlinPluginMode getPluginMode() {
+ return KotlinPluginMode.K1;
+ }
+
+ private void runTest(String testDataFilePath) throws Exception {
+ KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
+ }
+
+ @TestMetadata("beforeAndAfterBlockExpression.kt")
+ public void testBeforeAndAfterBlockExpression() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt");
+ }
+
+ @TestMetadata("beforeAndAfterEscapeSequence.kt")
+ public void testBeforeAndAfterEscapeSequence() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt");
+ }
+
+ @TestMetadata("beforeAndAfterSimpleNameExpression.kt")
+ public void testBeforeAndAfterSimpleNameExpression() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt");
+ }
+
+ @TestMetadata("blockSlashEscapeOnlyFirst.kt")
+ public void testBlockSlashEscapeOnlyFirst() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt");
+ }
+
+ @TestMetadata("blockSlashEscapingMixed.kt")
+ public void testBlockSlashEscapingMixed() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt");
+ }
+
+ @TestMetadata("canEscapeAllBeforeNumber.kt")
+ public void testCanEscapeAllBeforeNumber() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt");
+ }
+
+ @TestMetadata("multipleBlockEscapedDollars.kt")
+ public void testMultipleBlockEscapedDollars() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt");
+ }
+
+ @TestMetadata("multipleSlashEscapedDollars.kt")
+ public void testMultipleSlashEscapedDollars() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt");
+ }
+
+ @TestMetadata("noPrefixSimplifiableBeforeBlockExpression.kt")
+ public void testNoPrefixSimplifiableBeforeBlockExpression() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscape.kt")
+ public void testNoPrefixSingleQuoteBlockEscape() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeBeforeBacktick() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeBeforeLetter.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeBeforeLetter() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeBeforeUnderscore() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteBlockEscapeNoReplacement.kt")
+ public void testNoPrefixSingleQuoteBlockEscapeNoReplacement() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeNoReplacement.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteMultipleReplacements.kt")
+ public void testNoPrefixSingleQuoteMultipleReplacements() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscape.kt")
+ public void testNoPrefixSingleQuoteSlashEscape() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeBeforeBackticks() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeBeforeLetter.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeBeforeLetter() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeBeforeUnderscore() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt");
+ }
+
+ @TestMetadata("noPrefixSingleQuoteSlashEscapeNoReplacement.kt")
+ public void testNoPrefixSingleQuoteSlashEscapeNoReplacement() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeNoReplacement.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuote.kt")
+ public void testNoPrefixTripleQuote() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeBacktick.kt")
+ public void testNoPrefixTripleQuoteBeforeBacktick() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeBlock.kt")
+ public void testNoPrefixTripleQuoteBeforeBlock() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeLetter.kt")
+ public void testNoPrefixTripleQuoteBeforeLetter() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteBeforeUnderscore.kt")
+ public void testNoPrefixTripleQuoteBeforeUnderscore() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteMultipleReplacements.kt")
+ public void testNoPrefixTripleQuoteMultipleReplacements() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("noPrefixTripleQuoteNonEscapingBackslashes.kt")
+ public void testNoPrefixTripleQuoteNonEscapingBackslashes() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteNonEscapingBackslashes.kt");
+ }
+
+ @TestMetadata("notApplicableBacktickIdentifier.kt")
+ public void testNotApplicableBacktickIdentifier() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBacktickIdentifier.kt");
+ }
+
+ @TestMetadata("notApplicableBlockEscapedAfterDollar.kt")
+ public void testNotApplicableBlockEscapedAfterDollar() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedAfterDollar.kt");
+ }
+
+ @TestMetadata("notApplicableBlockEscapedBeforeDollar.kt")
+ public void testNotApplicableBlockEscapedBeforeDollar() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedBeforeDollar.kt");
+ }
+
+ @TestMetadata("notApplicableCurlyBraces.kt")
+ public void testNotApplicableCurlyBraces() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableCurlyBraces.kt");
+ }
+
+ @TestMetadata("notApplicableSlashEscapedAfterDollar.kt")
+ public void testNotApplicableSlashEscapedAfterDollar() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedAfterDollar.kt");
+ }
+
+ @TestMetadata("notApplicableSlashEscapedBeforeDollar.kt")
+ public void testNotApplicableSlashEscapedBeforeDollar() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedBeforeDollar.kt");
+ }
+
+ @TestMetadata("notApplicableUnderscoredIdentifier.kt")
+ public void testNotApplicableUnderscoredIdentifier() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableUnderscoredIdentifier.kt");
+ }
+
+ @TestMetadata("prefix4Safe.kt")
+ public void testPrefix4Safe() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt");
+ }
+
+ @TestMetadata("prefix4SafeLong.kt")
+ public void testPrefix4SafeLong() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt");
+ }
+
+ @TestMetadata("prefix4Unsafe.kt")
+ public void testPrefix4Unsafe() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Unsafe.kt");
+ }
+
+ @TestMetadata("singleBlockEscapedDollar.kt")
+ public void testSingleBlockEscapedDollar() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt");
+ }
+
+ @TestMetadata("singleDollarPrefixSingleQuoteMultipleReplacements.kt")
+ public void testSingleDollarPrefixSingleQuoteMultipleReplacements() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("singleDollarPrefixTripleQuoteMultipleReplacements.kt")
+ public void testSingleDollarPrefixTripleQuoteMultipleReplacements() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt");
+ }
+
+ @TestMetadata("singleSlashEscapedDollar.kt")
+ public void testSingleSlashEscapedDollar() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt");
+ }
+
+ @TestMetadata("slashBlockEscapeOnlyFirst.kt")
+ public void testSlashBlockEscapeOnlyFirst() throws Exception {
+ runTest("testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt");
+ }
+ }
+
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("testData/inspectionsLocal/cascadeIf")
public static class CascadeIf extends AbstractLocalInspectionTest {
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/.inspection b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/.inspection
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/.k2Inspection b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/.k2Inspection
new file mode 100644
index 000000000000..56f3a5138687
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/.k2Inspection
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.k2.codeinsight.inspections.CanUnescapeDollarLiteralInspection
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt
new file mode 100644
index 000000000000..74ff0f3c5743
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$${'$'}\$$\$$${42}\$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt.after
new file mode 100644
index 000000000000..15cca1444d57
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterBlockExpression.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$$$$$${42}$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt
new file mode 100644
index 000000000000..cb224b727aca
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$${'$'}\$$\$\t\$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt.after
new file mode 100644
index 000000000000..9c6d181c9781
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterEscapeSequence.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$$$$\t$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt
new file mode 100644
index 000000000000..9692f0b13ba6
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ val a = "A"
+ $$"$${'$'}\$$\$$$a\$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt.after
new file mode 100644
index 000000000000..6fe073e9c3b2
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/beforeAndAfterSimpleNameExpression.kt.after
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ val a = "A"
+ $$"$$$$$$a$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt
new file mode 100644
index 000000000000..9ee5bf754c87
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$${'$'}\$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt.after
new file mode 100644
index 000000000000..42d707a2ac10
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapeOnlyFirst.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$\$Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt
new file mode 100644
index 000000000000..2448a6e1768b
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"\$$${'$'}$${'$'}\$"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt.after
new file mode 100644
index 000000000000..9dc4045f1c0d
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/blockSlashEscapingMixed.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$$$$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt
new file mode 100644
index 000000000000..3fa5d89374d1
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"\$\$\$\$1"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt.after
new file mode 100644
index 000000000000..993fca50ec9a
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/canEscapeAllBeforeNumber.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$$$$1"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt
new file mode 100644
index 000000000000..8caa55d6a30f
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$${'$'}$${'$'}$${'$'}"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt.after
new file mode 100644
index 000000000000..7f5925ba2827
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleBlockEscapedDollars.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$$$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt
new file mode 100644
index 000000000000..74239c56d8e1
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"\$\$\$"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt.after
new file mode 100644
index 000000000000..7f5925ba2827
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/multipleSlashEscapedDollars.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$$$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt
new file mode 100644
index 000000000000..59272ddec22d
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "${'$'}$\$${'$'}${42 + 15}"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt.after
new file mode 100644
index 000000000000..ab69e027fbcb
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSimplifiableBeforeBlockExpression.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$$$${42 + 15}"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt
new file mode 100644
index 000000000000..526363b9c806
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "${'$'}${'$'}${'$'}"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt.after
new file mode 100644
index 000000000000..f2ae5e5c7913
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscape.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt
new file mode 100644
index 000000000000..71f561c45640
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "${'$'}${'$'}${'$'}`Foo Bar`"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt.after
new file mode 100644
index 000000000000..21efdc252bdb
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeBacktick.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$${'$'}`Foo Bar`"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt
new file mode 100644
index 000000000000..2a831cd3b30d
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "${'$'}${'$'}${'$'}Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt.after
new file mode 100644
index 000000000000..ba3169c37b0e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeLetter.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$${'$'}Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt
new file mode 100644
index 000000000000..449e8c527fdb
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "${'$'}${'$'}${'$'}_Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt.after
new file mode 100644
index 000000000000..4b47658fac99
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeBeforeUnderscore.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$${'$'}_Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeNoReplacement.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeNoReplacement.kt
new file mode 100644
index 000000000000..10359c442793
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteBlockEscapeNoReplacement.kt
@@ -0,0 +1,6 @@
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ "Foo${'$'}Bar"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt
new file mode 100644
index 000000000000..4194c155c8a8
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "${'$'}\$ Foo\$Bar \$${'$'}`Boo` ${'$'}\$\$${'$'}_Baz\$$$$${'$'} \$\$\$\$ Bee \$\$42 \$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt.after
new file mode 100644
index 000000000000..38fdffa2ffaf
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteMultipleReplacements.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$ Foo\$Bar $${'$'}`Boo` $$$${'$'}_Baz$$$$$ $$$$ Bee $$42 $"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt
new file mode 100644
index 000000000000..ae4069efb84f
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "\$\$\$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt.after
new file mode 100644
index 000000000000..f2ae5e5c7913
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscape.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt
new file mode 100644
index 000000000000..27edccd4089c
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "\$\$\$`Foo Bar`"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt.after
new file mode 100644
index 000000000000..e619f174d860
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeBackticks.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$\$`Foo Bar`"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt
new file mode 100644
index 000000000000..9e9c3c40d073
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "\$\$\$Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt.after
new file mode 100644
index 000000000000..492493b5ba1f
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeLetter.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$\$Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt
new file mode 100644
index 000000000000..63a97e6872c8
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "\$\$\$_Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt.after
new file mode 100644
index 000000000000..cdbed4a2ba28
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeBeforeUnderscore.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ "$$\$_Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeNoReplacement.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeNoReplacement.kt
new file mode 100644
index 000000000000..a35608193893
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixSingleQuoteSlashEscapeNoReplacement.kt
@@ -0,0 +1,6 @@
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ "Foo\$Bar"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt
new file mode 100644
index 000000000000..e6b528ba529c
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """${'$'}${'$'}${'$'}"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt.after
new file mode 100644
index 000000000000..6bcbce1b8303
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuote.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """$$$"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt
new file mode 100644
index 000000000000..0c2ca779999e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """${'$'}${'$'}${'$'}`Foo`"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt.after
new file mode 100644
index 000000000000..267e0f449e71
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBacktick.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """$$${'$'}`Foo`"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt
new file mode 100644
index 000000000000..69caae6c4c83
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """${'$'}${'$'}${'$'}{Foo}"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt.after
new file mode 100644
index 000000000000..2278326fe6e6
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeBlock.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """$$${'$'}{Foo}"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt
new file mode 100644
index 000000000000..bef2ba886eda
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """${'$'}${'$'}${'$'}Foo"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt.after
new file mode 100644
index 000000000000..dedc47ecd0bc
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeLetter.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """$$${'$'}Foo"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt
new file mode 100644
index 000000000000..917f6bf23f0e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """${'$'}${'$'}${'$'}_Foo"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt.after
new file mode 100644
index 000000000000..11e6a8b5ccd6
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteBeforeUnderscore.kt.after
@@ -0,0 +1,5 @@
+// IGNORE_K1
+
+fun test() {
+ """$$${'$'}_Foo"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt
new file mode 100644
index 000000000000..be6a046cdd79
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt
@@ -0,0 +1,14 @@
+// IGNORE_K1
+
+fun test() {
+ """
+ \$\$\$
+ Foo${'$'}Bar
+ ${'$'}${'$'}${'$'}
+ ${'$'}${'$'}`Baz Boo`
+ ${'$'}${'$'}{}
+ ${'$'}${'$'}_Goo${'$'}${'$'}
+ ${'$'}${'$'} Foo
+ ${'$'}${'$'}${'$'}
+${'$'}${'$'}"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt.after
new file mode 100644
index 000000000000..349ebb92d3c7
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteMultipleReplacements.kt.after
@@ -0,0 +1,14 @@
+// IGNORE_K1
+
+fun test() {
+ """
+ \$\$\$
+ Foo${'$'}Bar
+ $$$
+ $${'$'}`Baz Boo`
+ $${'$'}{}
+ $${'$'}_Goo$$
+ $$ Foo
+ $$$
+$$"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteNonEscapingBackslashes.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteNonEscapingBackslashes.kt
new file mode 100644
index 000000000000..b9eb91a8f16d
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/noPrefixTripleQuoteNonEscapingBackslashes.kt
@@ -0,0 +1,6 @@
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ """\$\$\$"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBacktickIdentifier.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBacktickIdentifier.kt
new file mode 100644
index 000000000000..588593676da3
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBacktickIdentifier.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$"\$$`Foo Bar`"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedAfterDollar.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedAfterDollar.kt
new file mode 100644
index 000000000000..910bd62f6ef9
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedAfterDollar.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$"$$${'$'}Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedBeforeDollar.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedBeforeDollar.kt
new file mode 100644
index 000000000000..264b0dcc2261
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableBlockEscapedBeforeDollar.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$"$${'$'}$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableCurlyBraces.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableCurlyBraces.kt
new file mode 100644
index 000000000000..578b913e54c4
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableCurlyBraces.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$"\$${Foo}"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedAfterDollar.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedAfterDollar.kt
new file mode 100644
index 000000000000..50f51106a747
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedAfterDollar.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$"$\$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedBeforeDollar.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedBeforeDollar.kt
new file mode 100644
index 000000000000..b7c3ffb9d6dc
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableSlashEscapedBeforeDollar.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$"\$$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableUnderscoredIdentifier.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableUnderscoredIdentifier.kt
new file mode 100644
index 000000000000..6cb3aadbb0ba
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/notApplicableUnderscoredIdentifier.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$"\$$_Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt
new file mode 100644
index 000000000000..dfd5dbbce559
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$$$"\$$$$$${'$'}Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt.after
new file mode 100644
index 000000000000..af73e8c4376c
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Safe.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$$$"$$$Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt
new file mode 100644
index 000000000000..3e3e678f8279
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$$$"\$$$$$${'$'}Foo\$\$\$\$\$\$\$\$"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt.after
new file mode 100644
index 000000000000..c0cb1bc03440
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4SafeLong.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$$$"$$$Foo$$$$$$$$"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Unsafe.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Unsafe.kt
new file mode 100644
index 000000000000..c39212086403
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/prefix4Unsafe.kt
@@ -0,0 +1,7 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+// PROBLEM: none
+
+fun test() {
+ $$$$"\$$$$Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt
new file mode 100644
index 000000000000..dcfa420adc36
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$${'$'}"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt.after
new file mode 100644
index 000000000000..3793421e3a07
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleBlockEscapedDollar.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt
new file mode 100644
index 000000000000..af2f4939a4a9
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $"${'$'}\$ Foo\$Bar \$${'$'}`Boo` ${'$'}\$\$${'$'}_Baz\$$$$${'$'} \$\$\$\$ Bee \$\$42 \$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt.after
new file mode 100644
index 000000000000..934c387aac56
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixSingleQuoteMultipleReplacements.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $"$$ Foo\$Bar $${'$'}`Boo` $$$${'$'}_Baz$$$$$ $$$$ Bee $$42 $"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt
new file mode 100644
index 000000000000..6fcd6152c08e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt
@@ -0,0 +1,15 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $"""
+ \$\$\$
+ Foo${'$'}Bar
+ ${'$'}${'$'}${'$'}
+ ${'$'}${'$'}`Baz Boo`
+ ${'$'}${'$'}{}
+ ${'$'}${'$'}_Goo${'$'}${'$'}
+ ${'$'}${'$'} Foo
+ ${'$'}${'$'}${'$'}
+${'$'}${'$'}"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt.after
new file mode 100644
index 000000000000..a3f83ff00119
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleDollarPrefixTripleQuoteMultipleReplacements.kt.after
@@ -0,0 +1,15 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $"""
+ \$\$\$
+ Foo${'$'}Bar
+ $$$
+ $${'$'}`Baz Boo`
+ $${'$'}{}
+ $${'$'}_Goo$$
+ $$ Foo
+ $$$
+$$"""
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt
new file mode 100644
index 000000000000..7d5d4b7af056
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"\$"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt.after
new file mode 100644
index 000000000000..3793421e3a07
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/singleSlashEscapedDollar.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt
new file mode 100644
index 000000000000..007bfeae581b
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"\$$${'$'}Foo"
+}
diff --git a/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt.after b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt.after
new file mode 100644
index 000000000000..003441f68f03
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/inspectionsLocal/canSimplifyDollarLiteral/slashBlockEscapeOnlyFirst.kt.after
@@ -0,0 +1,6 @@
+// COMPILER_ARGUMENTS: -Xmulti-dollar-interpolation
+// IGNORE_K1
+
+fun test() {
+ $$"$$${'$'}Foo"
+}
\ No newline at end of file
diff --git a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2InspectionTests.kt b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2InspectionTests.kt
index 2e6fe8a07e13..0e9a1f87ab06 100644
--- a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2InspectionTests.kt
+++ b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2InspectionTests.kt
@@ -65,6 +65,7 @@ internal fun MutableTWorkspace.generateK2InspectionTests() {
model("${idea}/inspectionsLocal/canBeParameter")
model("${idea}/inspectionsLocal/arrayInDataClass")
model("${idea}/inspectionsLocal/collections/simplifiableCallChain")
+ model("${idea}/inspectionsLocal/canSimplifyDollarLiteral")
model("code-insight/inspections-k2/tests/testData/inspectionsLocal", pattern = pattern)
}
/**