KT-11295 AssertionError in ConvertToStringTemplateIntention.fold
#KT-11295 Fixed
This commit is contained in:
@@ -99,7 +99,8 @@ class ConvertToStringTemplateIntention : SelfTargetingOffsetIndependentIntention
|
|||||||
val type = bindingContext.getType(expression)!!
|
val type = bindingContext.getType(expression)!!
|
||||||
|
|
||||||
if (KotlinBuiltIns.isChar(type)) {
|
if (KotlinBuiltIns.isChar(type)) {
|
||||||
return expressionText.removePrefix("'").removeSuffix("'")
|
val value = expressionText.removePrefix("'").removeSuffix("'")
|
||||||
|
return if (value == "\"") "\\\"" else value
|
||||||
}
|
}
|
||||||
|
|
||||||
val constant = ConstantExpressionEvaluator.getConstant(expression, bindingContext)
|
val constant = ConstantExpressionEvaluator.getConstant(expression, bindingContext)
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
val TABLE_PREFIX = ""
|
||||||
|
|
||||||
|
fun test(): String {
|
||||||
|
return <caret>TABLE_PREFIX + '"'
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
val TABLE_PREFIX = ""
|
||||||
|
|
||||||
|
fun test(): String {
|
||||||
|
return <caret>"$TABLE_PREFIX\""
|
||||||
|
}
|
||||||
@@ -4735,6 +4735,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt11295.kt")
|
||||||
|
public void testKt11295() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToStringTemplate/kt11295.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("multilineString.kt")
|
@TestMetadata("multilineString.kt")
|
||||||
public void testMultilineString() throws Exception {
|
public void testMultilineString() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToStringTemplate/multilineString.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertToStringTemplate/multilineString.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user