Fix callable code factory (parameter with default value case)

Before we can have end of '<Type>' and '=' joined as '>=' breaking PSI
So #KT-15941 Fixed
This commit is contained in:
Toshiaki Kameyama
2017-11-22 14:56:44 +03:00
committed by Mikhail Glukhikh
parent 21bd10da2e
commit 7448042b68
4 changed files with 15 additions and 1 deletions
@@ -691,7 +691,7 @@ class KtPsiFactory @JvmOverloads constructor(private val project: Project, val m
}
sb.append(name).append(": ").append(type)
if (defaultValue != null) {
sb.append("= ").append(defaultValue)
sb.append(" = ").append(defaultValue)
}
if (state == State.FIRST_PARAM) {
state = State.REST_PARAMS
@@ -0,0 +1 @@
class Test<caret>(val a: Array<Int> = arrayOf(0))
@@ -0,0 +1,7 @@
class Test {
val a: Array<Int>
constructor(a: Array<Int> = arrayOf(0)) {
this.a = a
}
}
@@ -5624,6 +5624,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
doTest(fileName);
}
@TestMetadata("genericParamWithDefaultValue.kt")
public void testGenericParamWithDefaultValue() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/genericParamWithDefaultValue.kt");
doTest(fileName);
}
@TestMetadata("independentProperty.kt")
public void testIndependentProperty() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/independentProperty.kt");