Fix referencing inner class constructor on an outer class instance
#KT-12796 Fixed
This commit is contained in:
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
abstract class A {
|
||||||
|
inner class InnerInA {
|
||||||
|
fun returnOk() = "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class B : A()
|
||||||
|
|
||||||
|
fun foo(a: A): String {
|
||||||
|
if (a is B) {
|
||||||
|
val v = a::InnerInA
|
||||||
|
return v().returnOk()
|
||||||
|
}
|
||||||
|
|
||||||
|
return "error"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return foo(B())
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
|
||||||
|
|
||||||
|
abstract class A {
|
||||||
|
inner class InnerInA
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class B : A()
|
||||||
|
|
||||||
|
fun foo(a: A) {
|
||||||
|
if (a is B) {
|
||||||
|
val v = a::InnerInA
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun foo(/*0*/ a: A): kotlin.Unit
|
||||||
|
|
||||||
|
public abstract class A {
|
||||||
|
public constructor 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 final inner class InnerInA {
|
||||||
|
public constructor InnerInA()
|
||||||
|
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 abstract class B : A {
|
||||||
|
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
|
||||||
|
}
|
||||||
+6
@@ -1936,6 +1936,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
|
||||||
|
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("innerConstructorFromClass.kt")
|
@TestMetadata("innerConstructorFromClass.kt")
|
||||||
public void testInnerConstructorFromClass() throws Exception {
|
public void testInnerConstructorFromClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
||||||
|
|||||||
@@ -2580,6 +2580,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassConstructorOnOuterClassInstance.kt")
|
||||||
|
public void testInnerClassConstructorOnOuterClassInstance() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/callableReference/resolve/innerClassConstructorOnOuterClassInstance.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("intersectionTypeOverloadWithWrongParameter.kt")
|
@TestMetadata("intersectionTypeOverloadWithWrongParameter.kt")
|
||||||
public void testIntersectionTypeOverloadWithWrongParameter() throws Exception {
|
public void testIntersectionTypeOverloadWithWrongParameter() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt");
|
||||||
|
|||||||
+6
@@ -2580,6 +2580,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassConstructorOnOuterClassInstance.kt")
|
||||||
|
public void testInnerClassConstructorOnOuterClassInstance() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/callableReference/resolve/innerClassConstructorOnOuterClassInstance.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("intersectionTypeOverloadWithWrongParameter.kt")
|
@TestMetadata("intersectionTypeOverloadWithWrongParameter.kt")
|
||||||
public void testIntersectionTypeOverloadWithWrongParameter() throws Exception {
|
public void testIntersectionTypeOverloadWithWrongParameter() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/callableReference/resolve/intersectionTypeOverloadWithWrongParameter.kt");
|
||||||
|
|||||||
@@ -1936,6 +1936,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
|
||||||
|
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("innerConstructorFromClass.kt")
|
@TestMetadata("innerConstructorFromClass.kt")
|
||||||
public void testInnerConstructorFromClass() throws Exception {
|
public void testInnerConstructorFromClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
||||||
|
|||||||
@@ -1936,6 +1936,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
|
||||||
|
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("innerConstructorFromClass.kt")
|
@TestMetadata("innerConstructorFromClass.kt")
|
||||||
public void testInnerConstructorFromClass() throws Exception {
|
public void testInnerConstructorFromClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
||||||
|
|||||||
@@ -508,8 +508,8 @@ public class OverridingUtil {
|
|||||||
|
|
||||||
if (!isVisibilityMoreSpecific(a, b)) return false;
|
if (!isVisibilityMoreSpecific(a, b)) return false;
|
||||||
|
|
||||||
if (a instanceof SimpleFunctionDescriptor) {
|
if (a instanceof FunctionDescriptor) {
|
||||||
assert b instanceof SimpleFunctionDescriptor : "b is " + b.getClass();
|
assert b instanceof FunctionDescriptor : "b is " + b.getClass();
|
||||||
|
|
||||||
return isReturnTypeMoreSpecific(a, aReturnType, b, bReturnType);
|
return isReturnTypeMoreSpecific(a, aReturnType, b, bReturnType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2278,6 +2278,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
|
||||||
|
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("innerConstructorFromClass.kt")
|
@TestMetadata("innerConstructorFromClass.kt")
|
||||||
public void testInnerConstructorFromClass() throws Exception {
|
public void testInnerConstructorFromClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/innerConstructorFromClass.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user