FE: add some more tests around static field fake overrides
This commit is contained in:
committed by
Space Team
parent
938e1d5ce8
commit
d436d56871
+12
@@ -34488,6 +34488,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaInterfaceFieldDirectAccess.kt")
|
||||
public void testJavaInterfaceFieldDirectAccess() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/javaInterfaceFieldDirectAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lackOfInvisibleSetterOfJavaClassInSamePackage.kt")
|
||||
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
|
||||
@@ -34518,6 +34524,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStatic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceFieldViaKotlinClass.kt")
|
||||
public void testPackagePrivateStaticInterfaceFieldViaKotlinClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStaticInterfaceFieldViaKotlinClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceMethod.kt")
|
||||
public void testPackagePrivateStaticInterfaceMethod() throws Exception {
|
||||
|
||||
+12
@@ -34584,6 +34584,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaInterfaceFieldDirectAccess.kt")
|
||||
public void testJavaInterfaceFieldDirectAccess() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/javaInterfaceFieldDirectAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lackOfInvisibleSetterOfJavaClassInSamePackage.kt")
|
||||
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
|
||||
@@ -34614,6 +34620,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStatic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceFieldViaKotlinClass.kt")
|
||||
public void testPackagePrivateStaticInterfaceFieldViaKotlinClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStaticInterfaceFieldViaKotlinClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceMethod.kt")
|
||||
public void testPackagePrivateStaticInterfaceMethod() throws Exception {
|
||||
|
||||
+12
@@ -34488,6 +34488,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaInterfaceFieldDirectAccess.kt")
|
||||
public void testJavaInterfaceFieldDirectAccess() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/javaInterfaceFieldDirectAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lackOfInvisibleSetterOfJavaClassInSamePackage.kt")
|
||||
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
|
||||
@@ -34518,6 +34524,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStatic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceFieldViaKotlinClass.kt")
|
||||
public void testPackagePrivateStaticInterfaceFieldViaKotlinClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStaticInterfaceFieldViaKotlinClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceMethod.kt")
|
||||
public void testPackagePrivateStaticInterfaceMethod() throws Exception {
|
||||
|
||||
+6
@@ -28477,6 +28477,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/javaInterop/genericSamSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaInterfaceFieldDirectAccess.kt")
|
||||
public void testJavaInterfaceFieldDirectAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaInterfaceFieldDirectAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaOuterClassDependsOnInner.kt")
|
||||
public void testJavaOuterClassDependsOnInner() throws Exception {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// FILE: javapackage/PublicParentInterface.java
|
||||
|
||||
package javapackage;
|
||||
|
||||
public interface PublicParentInterface {
|
||||
String publicStaticField = "OK";
|
||||
}
|
||||
|
||||
// FILE: Child.kt
|
||||
|
||||
import javapackage.PublicParentInterface
|
||||
|
||||
class Child : PublicParentInterface {
|
||||
fun foo(): String {
|
||||
return PublicParentInterface.publicStaticField
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = Child().foo()
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
FILE fqName:<root> fileName:/Child.kt
|
||||
CLASS CLASS name:Child modality:FINAL visibility:public superTypes:[javapackage.PublicParentClass]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Child
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Child [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in javapackage.PublicParentClass'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Child modality:FINAL visibility:public superTypes:[javapackage.PublicParentClass]'
|
||||
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.Child) returnType:kotlin.String
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Child
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in <root>.Child'
|
||||
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:publicStaticField type:kotlin.String visibility:public [final,static]' type=kotlin.String origin=GET_PROPERTY
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in javapackage.PublicParentClass
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in javapackage.PublicParentClass
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in javapackage.PublicParentClass
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FILE fqName:<root> fileName:/test.kt
|
||||
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||
CALL 'public final fun foo (): kotlin.String declared in <root>.Child' type=kotlin.String origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Child' type=<root>.Child origin=null
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
FILE fqName:<root> fileName:/Child.kt
|
||||
CLASS CLASS name:Child modality:FINAL visibility:public superTypes:[javapackage.PublicParentClass]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Child
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Child [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in javapackage.PublicParentClass'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Child modality:FINAL visibility:public superTypes:[javapackage.PublicParentClass]'
|
||||
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.Child) returnType:kotlin.String
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Child
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in <root>.Child'
|
||||
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:publicStaticField type:kotlin.String visibility:public [final,static]' type=kotlin.String origin=GET_PROPERTY
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in javapackage.PublicParentClass
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in javapackage.PublicParentClass
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String [fake_override] declared in javapackage.PublicParentClass
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FILE fqName:<root> fileName:/test.kt
|
||||
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in <root>'
|
||||
CALL 'public final fun foo (): kotlin.String declared in <root>.Child' type=kotlin.String origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Child' type=<root>.Child origin=null
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// DUMP_IR
|
||||
// FILE: javapackage/PackagePrivateGrandparentAbstractClass.java
|
||||
|
||||
package javapackage;
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: javapackage/PublicParentInterface.java
|
||||
|
||||
package javapackage;
|
||||
|
||||
public interface PublicParentInterface {
|
||||
String publicStaticField = "OK";
|
||||
}
|
||||
|
||||
// FILE: Child.kt
|
||||
|
||||
import javapackage.PublicParentInterface
|
||||
|
||||
class Child : PublicParentInterface {
|
||||
fun foo(): String {
|
||||
return <!UNRESOLVED_REFERENCE!>publicStaticField<!>
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package
|
||||
|
||||
public final class Child : javapackage.PublicParentInterface {
|
||||
public constructor Child()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
package javapackage {
|
||||
|
||||
public interface PublicParentInterface {
|
||||
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
|
||||
|
||||
// Static members
|
||||
public const final val publicStaticField: kotlin.String = "OK"
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
FILE: KotlinParentClass.kt
|
||||
package javapackage
|
||||
|
||||
public final class KotlinParentClass : R|javapackage/PackagePrivateGrandparentInterface| {
|
||||
public constructor(): R|javapackage/KotlinParentClass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
FILE: Child.kt
|
||||
public final class Child : R|javapackage/PublicParentClass| {
|
||||
public constructor(): R|Child| {
|
||||
super<R|javapackage/PublicParentClass|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/String| = R|javapackage/PackagePrivateGrandparentInterface.publicStaticField|
|
||||
lval y: R|kotlin/String| = Q|javapackage/PublicParentClass|.R|javapackage/PackagePrivateGrandparentInterface.publicStaticField|
|
||||
lval z: <ERROR TYPE REF: Unresolved name: publicStaticField> = Q|javapackage/KotlinParentClass|.<Unresolved name: publicStaticField>#
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// FIR_IDENTICAL
|
||||
// FIR_DUMP
|
||||
// FILE: javapackage/PackagePrivateGrandparentAbstractClass.java
|
||||
|
||||
package javapackage;
|
||||
|
||||
/*package-private*/ interface PackagePrivateGrandparentInterface {
|
||||
public static String publicStaticField = "OK";
|
||||
}
|
||||
|
||||
// FILE: javapackage/KotlinParentClass.kt
|
||||
|
||||
package javapackage
|
||||
|
||||
class KotlinParentClass : PackagePrivateGrandparentInterface
|
||||
|
||||
// FILE: javapackage/PublicParentClass.java
|
||||
|
||||
package javapackage;
|
||||
|
||||
public class PublicParentClass extends KotlinParentClass {}
|
||||
|
||||
// FILE: Child.kt
|
||||
|
||||
import javapackage.PublicParentClass
|
||||
import javapackage.KotlinParentClass
|
||||
|
||||
class Child : PublicParentClass() {
|
||||
fun foo() {
|
||||
val x = publicStaticField
|
||||
val y = PublicParentClass.publicStaticField
|
||||
val z = KotlinParentClass.<!UNRESOLVED_REFERENCE!>publicStaticField<!>
|
||||
}
|
||||
}
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
public final class Child : javapackage.PublicParentClass {
|
||||
public constructor Child()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
package javapackage {
|
||||
|
||||
public final class KotlinParentClass : javapackage.PackagePrivateGrandparentInterface {
|
||||
public constructor KotlinParentClass()
|
||||
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/*package*/ interface PackagePrivateGrandparentInterface {
|
||||
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
|
||||
|
||||
// Static members
|
||||
public const final val publicStaticField: kotlin.String = "OK"
|
||||
}
|
||||
|
||||
public open class PublicParentClass : javapackage.KotlinParentClass {
|
||||
public constructor PublicParentClass()
|
||||
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
|
||||
|
||||
// Static members
|
||||
public const final override /*1*/ /*fake_override*/ val publicStaticField: kotlin.String = "OK"
|
||||
}
|
||||
}
|
||||
Generated
+12
@@ -34584,6 +34584,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaInterfaceFieldDirectAccess.kt")
|
||||
public void testJavaInterfaceFieldDirectAccess() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/javaInterfaceFieldDirectAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lackOfInvisibleSetterOfJavaClassInSamePackage.kt")
|
||||
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
|
||||
@@ -34614,6 +34620,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStatic.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceFieldViaKotlinClass.kt")
|
||||
public void testPackagePrivateStaticInterfaceFieldViaKotlinClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/visibility/packagePrivateStaticInterfaceFieldViaKotlinClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("packagePrivateStaticInterfaceMethod.kt")
|
||||
public void testPackagePrivateStaticInterfaceMethod() throws Exception {
|
||||
|
||||
+6
@@ -28477,6 +28477,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/javaInterop/genericSamSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaInterfaceFieldDirectAccess.kt")
|
||||
public void testJavaInterfaceFieldDirectAccess() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/javaInterop/javaInterfaceFieldDirectAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("javaOuterClassDependsOnInner.kt")
|
||||
public void testJavaOuterClassDependsOnInner() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user