Don't allow to use own members when resolve super constructor call in (companion) object
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ class ClassResolutionScopesSupport(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public val scopeForConstructorHeaderResolution: () -> LexicalScope = storageManager.createLazyValue {
|
public val scopeForConstructorHeaderResolution: () -> LexicalScope = storageManager.createLazyValue {
|
||||||
scopeWithGenerics(scopeForStaticMemberDeclarationResolution())
|
scopeWithGenerics(if (classDescriptor.kind.isSingleton) scopeForCompanionObjectHeaderResolution() else scopeForStaticMemberDeclarationResolution())
|
||||||
}
|
}
|
||||||
|
|
||||||
private val inheritanceScopeWithoutMe: () -> LexicalScope = storageManager.createLazyValue(onRecursion = createThrowingLexicalScope) {
|
private val inheritanceScopeWithoutMe: () -> LexicalScope = storageManager.createLazyValue(onRecursion = createThrowingLexicalScope) {
|
||||||
|
|||||||
Vendored
+19
@@ -0,0 +1,19 @@
|
|||||||
|
open class S(val a: Any, val b: Any, val c: Any) {}
|
||||||
|
|
||||||
|
interface A {
|
||||||
|
companion object : S(<!UNRESOLVED_REFERENCE!>prop1<!>, <!UNRESOLVED_REFERENCE!>prop2<!>, <!UNRESOLVED_REFERENCE!>func<!>()) {
|
||||||
|
val prop1 = 1
|
||||||
|
val prop2: Int
|
||||||
|
get() = 1
|
||||||
|
fun func() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B {
|
||||||
|
companion object : S(<!UNRESOLVED_REFERENCE!>prop1<!>, <!UNRESOLVED_REFERENCE!>prop2<!>, <!UNRESOLVED_REFERENCE!>func<!>()) {
|
||||||
|
val prop1 = 1
|
||||||
|
val prop2: Int
|
||||||
|
get() = 1
|
||||||
|
fun func() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface A {
|
||||||
|
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
|
||||||
|
|
||||||
|
public companion object Companion : S {
|
||||||
|
private constructor Companion()
|
||||||
|
public final override /*1*/ /*fake_override*/ val a: kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ val b: kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ val c: kotlin.Any
|
||||||
|
public final val prop1: kotlin.Int = 1
|
||||||
|
public final val prop2: kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun func(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
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
|
||||||
|
|
||||||
|
public companion object Companion : S {
|
||||||
|
private constructor Companion()
|
||||||
|
public final override /*1*/ /*fake_override*/ val a: kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ val b: kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ val c: kotlin.Any
|
||||||
|
public final val prop1: kotlin.Int = 1
|
||||||
|
public final val prop2: kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun func(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class S {
|
||||||
|
public constructor S(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Any, /*2*/ c: kotlin.Any)
|
||||||
|
public final val a: kotlin.Any
|
||||||
|
public final val b: kotlin.Any
|
||||||
|
public final val c: kotlin.Any
|
||||||
|
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
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
open class S(val a: Any, val b: Any, val c: Any) {}
|
||||||
|
|
||||||
|
object A : S(<!UNRESOLVED_REFERENCE!>prop1<!>, <!UNRESOLVED_REFERENCE!>prop2<!>, <!UNRESOLVED_REFERENCE!>func<!>()) {
|
||||||
|
val prop1 = 1
|
||||||
|
val prop2: Int
|
||||||
|
get() = 1
|
||||||
|
fun func() {}
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public object A : S {
|
||||||
|
private constructor A()
|
||||||
|
public final override /*1*/ /*fake_override*/ val a: kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ val b: kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ val c: kotlin.Any
|
||||||
|
public final val prop1: kotlin.Int = 1
|
||||||
|
public final val prop2: kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public final fun func(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class S {
|
||||||
|
public constructor S(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Any, /*2*/ c: kotlin.Any)
|
||||||
|
public final val a: kotlin.Any
|
||||||
|
public final val b: kotlin.Any
|
||||||
|
public final val c: kotlin.Any
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -14018,6 +14018,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("companionObjectSuperConstructorArguments.kt")
|
||||||
|
public void testCompanionObjectSuperConstructorArguments() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/classHeader/companionObjectSuperConstructorArguments.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("constructors.kt")
|
@TestMetadata("constructors.kt")
|
||||||
public void testConstructors() throws Exception {
|
public void testConstructors() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/classHeader/constructors.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/classHeader/constructors.kt");
|
||||||
@@ -14036,6 +14042,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectSuperConstructorArguments.kt")
|
||||||
|
public void testObjectSuperConstructorArguments() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/classHeader/objectSuperConstructorArguments.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("simpleDelegation.kt")
|
@TestMetadata("simpleDelegation.kt")
|
||||||
public void testSimpleDelegation() throws Exception {
|
public void testSimpleDelegation() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/classHeader/simpleDelegation.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/classHeader/simpleDelegation.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user