Add constructors to KtScope
- KtClassLikeSymbol.primaryConstructor was removed - Constructors were removed from getCallableMembers because constructors has no name (or special name `<init>`) and previous implementation was incorrect - KtScope.getAllSymbols returns constructors as before. Before it was like this because of the incorrect implementation of getCallableMembers - getConstructors has sence only for class scope, for the rest cases it is empty
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
public final class Constructors /* Constructors*/ {
|
||||
private final int valInPrimary;
|
||||
|
||||
private Constructors();// .ctor()
|
||||
|
||||
public Constructors(@org.jetbrains.annotations.NotNull() java.lang.String);// .ctor(java.lang.String)
|
||||
|
||||
public Constructors(int);// .ctor(int)
|
||||
|
||||
public final int getValInPrimary();// getValInPrimary()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// Constructors
|
||||
|
||||
class Constructors(val valInPrimary: Int) {
|
||||
constructor(parameterInSecondary: String): this(4)
|
||||
private constructor(): this(2)
|
||||
}
|
||||
|
||||
// LAZINESS:NoLaziness
|
||||
// FIR_COMPARISON
|
||||
@@ -0,0 +1,6 @@
|
||||
public final class OnlySecondaryConstructors /* OnlySecondaryConstructors*/ {
|
||||
public OnlySecondaryConstructors();// .ctor()
|
||||
|
||||
public OnlySecondaryConstructors(int);// .ctor(int)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// OnlySecondaryConstructors
|
||||
|
||||
class OnlySecondaryConstructors {
|
||||
constructor(): super()
|
||||
constructor(p: Int): this()
|
||||
}
|
||||
|
||||
// LAZINESS:NoLaziness
|
||||
// FIR_COMPARISON
|
||||
+10
@@ -49,6 +49,11 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
runTest("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Constructors.kt")
|
||||
public void testConstructors() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/Constructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DataClassWithCustomImplementedMembers.kt")
|
||||
public void testDataClassWithCustomImplementedMembers() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/DataClassWithCustomImplementedMembers.kt");
|
||||
@@ -129,6 +134,11 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
runTest("compiler/testData/asJava/lightClasses/NonDataClassWithComponentFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OnlySecondaryConstructors.kt")
|
||||
public void testOnlySecondaryConstructors() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/OnlySecondaryConstructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("PublishedApi.kt")
|
||||
public void testPublishedApi() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/PublishedApi.kt");
|
||||
|
||||
Reference in New Issue
Block a user