Fixed KNPE in convert primary constructor to secondary #KT-14745 Fixed
This commit is contained in:
+1
-1
@@ -80,7 +80,7 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention<KtP
|
||||
val annotations = valueParameter.annotationEntries.joinToString(separator = " ") { it.text }
|
||||
val vararg = if (valueParameter.isVarArg) VARARG_KEYWORD.value else ""
|
||||
param("$annotations $vararg ${valueParameter.name ?: ""}",
|
||||
valueParameter.typeReference!!.text, valueParameter.defaultValue?.text)
|
||||
valueParameter.typeReference?.text ?: "", valueParameter.defaultValue?.text)
|
||||
}
|
||||
noReturnType()
|
||||
for (superTypeEntry in klass.getSuperTypeListEntries()) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// SKIP_ERRORS_BEFORE
|
||||
// SKIP_ERRORS_AFTER
|
||||
|
||||
class My<caret>(val x)
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// SKIP_ERRORS_BEFORE
|
||||
// SKIP_ERRORS_AFTER
|
||||
|
||||
class My {
|
||||
val x
|
||||
|
||||
constructor(x:) {
|
||||
this.x = x
|
||||
}
|
||||
}
|
||||
@@ -4862,6 +4862,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noArgType.kt")
|
||||
public void testNoArgType() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("paramsAndProperties.kt")
|
||||
public void testParamsAndProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/paramsAndProperties.kt");
|
||||
|
||||
Reference in New Issue
Block a user