Resolve property initializer if there is no primary constructor
This commit is contained in:
@@ -530,10 +530,7 @@ public class BodyResolver {
|
||||
JetExpression initializer = property.getInitializer();
|
||||
JetScope propertyScope = getScopeForProperty(c, property);
|
||||
if (initializer != null) {
|
||||
ConstructorDescriptor primaryConstructor = classDescriptor.getUnsubstitutedPrimaryConstructor();
|
||||
if (primaryConstructor != null) {
|
||||
resolvePropertyInitializer(c, property, propertyDescriptor, initializer, propertyScope);
|
||||
}
|
||||
resolvePropertyInitializer(c, property, propertyDescriptor, initializer, propertyScope);
|
||||
}
|
||||
|
||||
JetExpression delegateExpression = property.getDelegateExpression();
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class A {
|
||||
val prop: Int = <!TYPE_MISMATCH!>""<!>
|
||||
constructor() {}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
internal final class A {
|
||||
public constructor A()
|
||||
internal final val prop: kotlin.Int = ""
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -10535,6 +10535,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("resolvePropertyInitializerWithoutPrimary.kt")
|
||||
public void testResolvePropertyInitializerWithoutPrimary() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/resolvePropertyInitializerWithoutPrimary.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("return.kt")
|
||||
public void testReturn() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/return.kt");
|
||||
|
||||
Reference in New Issue
Block a user