diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 5a6cb536a12..fb62f7d3b06 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1606,24 +1606,39 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/ir/irText/types"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("intersectionType1.kt") - public void testIntersectionType1() throws Exception { - runTest("compiler/testData/ir/irText/types/intersectionType1.kt"); + @TestMetadata("intersectionType1_NI.kt") + public void testIntersectionType1_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType1_NI.kt"); } - @TestMetadata("intersectionType2.kt") - public void testIntersectionType2() throws Exception { - runTest("compiler/testData/ir/irText/types/intersectionType2.kt"); + @TestMetadata("intersectionType1_OI.kt") + public void testIntersectionType1_OI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType1_OI.kt"); } - @TestMetadata("intersectionType3.kt") - public void testIntersectionType3() throws Exception { - runTest("compiler/testData/ir/irText/types/intersectionType3.kt"); + @TestMetadata("intersectionType2_NI.kt") + public void testIntersectionType2_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType2_NI.kt"); } - @TestMetadata("localVariableOfIntersectionType.kt") - public void testLocalVariableOfIntersectionType() throws Exception { - runTest("compiler/testData/ir/irText/types/localVariableOfIntersectionType.kt"); + @TestMetadata("intersectionType2_OI.kt") + public void testIntersectionType2_OI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType2_OI.kt"); + } + + @TestMetadata("intersectionType3_NI.kt") + public void testIntersectionType3_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType3_NI.kt"); + } + + @TestMetadata("intersectionType3_OI.kt") + public void testIntersectionType3_OI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType3_OI.kt"); + } + + @TestMetadata("localVariableOfIntersectionType_NI.kt") + public void testLocalVariableOfIntersectionType_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt"); } } } diff --git a/compiler/testData/ir/irText/types/intersectionType1.fir.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.fir.txt similarity index 98% rename from compiler/testData/ir/irText/types/intersectionType1.fir.txt rename to compiler/testData/ir/irText/types/intersectionType1_NI.fir.txt index 8a7d3e684ad..4192cfd7441 100644 --- a/compiler/testData/ir/irText/types/intersectionType1.fir.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.fir.txt @@ -1,4 +1,4 @@ -FILE fqName: fileName:/intersectionType1.kt +FILE fqName: fileName:/intersectionType1_NI.kt CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In TYPE_PARAMETER name:I index:0 variance:in superTypes:[] diff --git a/compiler/testData/ir/irText/types/intersectionType1.kt b/compiler/testData/ir/irText/types/intersectionType1_NI.kt similarity index 91% rename from compiler/testData/ir/irText/types/intersectionType1.kt rename to compiler/testData/ir/irText/types/intersectionType1_NI.kt index 333daf95d22..e5b52fa4efa 100644 --- a/compiler/testData/ir/irText/types/intersectionType1.kt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.kt @@ -1,3 +1,5 @@ +// !LANGUAGE: +NewInference + class In fun select(x: S, y: S): S = x diff --git a/compiler/testData/ir/irText/types/intersectionType1.txt b/compiler/testData/ir/irText/types/intersectionType1_NI.txt similarity index 88% rename from compiler/testData/ir/irText/types/intersectionType1.txt rename to compiler/testData/ir/irText/types/intersectionType1_NI.txt index f64e19dd3af..d5586af773b 100644 --- a/compiler/testData/ir/irText/types/intersectionType1.txt +++ b/compiler/testData/ir/irText/types/intersectionType1_NI.txt @@ -1,35 +1,35 @@ -FILE fqName: fileName:/intersectionType1.kt +FILE fqName: fileName:/intersectionType1_NI.kt CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In.In> + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In.In> TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?] - CONSTRUCTOR visibility:public <> () returnType:.In.In> [primary] + CONSTRUCTOR visibility:public <> () returnType:.In.In> [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]' - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:select visibility:public modality:FINAL (x:S of .select, y:S of .select) returnType:S of .select + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:select visibility:public modality:FINAL (x:S of .select, y:S of .select) returnType:S of .select TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?] - VALUE_PARAMETER name:x index:0 type:S of .select - VALUE_PARAMETER name:y index:1 type:S of .select + VALUE_PARAMETER name:x index:0 type:S of .select + VALUE_PARAMETER name:y index:1 type:S of .select BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun select (x: S of .select, y: S of .select): S of .select declared in ' GET_VAR 'x: S of .select declared in .select' type=S of .select origin=null - FUN name:foo visibility:public modality:FINAL (a:kotlin.Array<.In.foo>>, b:kotlin.Array<.In>) returnType:kotlin.Boolean + FUN name:foo visibility:public modality:FINAL (a:kotlin.Array<.In.foo>>, b:kotlin.Array<.In>) returnType:kotlin.Boolean TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - VALUE_PARAMETER name:a index:0 type:kotlin.Array<.In.foo>> - VALUE_PARAMETER name:b index:1 type:kotlin.Array<.In> + VALUE_PARAMETER name:a index:0 type:kotlin.Array<.In.foo>> + VALUE_PARAMETER name:b index:1 type:kotlin.Array<.In> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun foo (a: kotlin.Array<.In.foo>>, b: kotlin.Array<.In>): kotlin.Boolean declared in ' CALL 'public final fun ofType (y: kotlin.Any?): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null @@ -43,17 +43,17 @@ FILE fqName: fileName:/intersectionType1.kt GET_VAR 'b: kotlin.Array<.In> declared in .foo' type=kotlin.Array<.In> origin=null index: CONST Int type=kotlin.Int value=0 y: CONST Boolean type=kotlin.Boolean value=true - FUN name:ofType visibility:public modality:FINAL ($receiver:.In.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline] + FUN name:ofType visibility:public modality:FINAL ($receiver:.In.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline] TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] - $receiver: VALUE_PARAMETER name: type:.In.ofType> - VALUE_PARAMETER name:y index:0 type:kotlin.Any? + $receiver: VALUE_PARAMETER name: type:.In.ofType> + VALUE_PARAMETER name:y index:0 type:kotlin.Any? BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun ofType (y: kotlin.Any?): kotlin.Boolean [inline] declared in ' TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=K of .ofType GET_VAR 'y: kotlin.Any? declared in .ofType' type=kotlin.Any? origin=null - FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit + FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR name:a1 type:kotlin.Array<.In> [val] + VAR name:a1 type:kotlin.Array<.In> [val] CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array [inline] declared in kotlin' type=kotlin.Array<.In> origin=null : .In elements: VARARG type=kotlin.Array.In> varargElementType=.In diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.fir.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.fir.txt new file mode 100644 index 00000000000..d1904d14e44 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.fir.txt @@ -0,0 +1,55 @@ +FILE fqName: fileName:/intersectionType1_OI.kt + CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In + TYPE_PARAMETER name:I index:0 variance:in superTypes:[] + CONSTRUCTOR visibility:public <> () returnType:.In.In> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:select visibility:public modality:FINAL (x:S of .select, y:S of .select) returnType:S of .select + TYPE_PARAMETER name:S index:0 variance: superTypes:[] + VALUE_PARAMETER name:x index:0 type:S of .select + VALUE_PARAMETER name:y index:1 type:S of .select + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun select (x: S of .select, y: S of .select): S of .select declared in ' + GET_VAR 'x: S of .select declared in .select' type=S of .select origin=null + FUN name:foo visibility:public modality:FINAL (a:kotlin.Array<.In.foo>>, b:kotlin.Array<.In>) returnType:kotlin.Boolean + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + VALUE_PARAMETER name:a index:0 type:kotlin.Array<.In.foo>> + VALUE_PARAMETER name:b index:1 type:kotlin.Array<.In> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (a: kotlin.Array<.In.foo>>, b: kotlin.Array<.In>): kotlin.Boolean declared in ' + CALL 'public final fun ofType (y: kotlin.Any?): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + y: CONST Boolean type=kotlin.Boolean value=true + FUN name:ofType visibility:public modality:FINAL (y:kotlin.Any?) returnType:kotlin.Boolean [inline] + TYPE_PARAMETER name:K index:0 variance: superTypes:[] + VALUE_PARAMETER name:y index:0 type:kotlin.Any? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun ofType (y: kotlin.Any?): kotlin.Boolean [inline] declared in ' + TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=K of .ofType + GET_VAR 'y: kotlin.Any? declared in .ofType' type=kotlin.Any? origin=null + FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + VAR name:a1 type:kotlin.Array> [val] + CALL 'public final fun arrayOf (elements: kotlin.Array>): kotlin.Array> [inline] declared in kotlin' type=kotlin.Array> origin=null + elements: CALL 'public constructor () [primary] declared in .In' type=.In.In> origin=null + VAR name:a2 type:kotlin.Array> [val] + CALL 'public final fun arrayOf (elements: kotlin.Array>): kotlin.Array> [inline] declared in kotlin' type=kotlin.Array> origin=null + elements: CALL 'public constructor () [primary] declared in .In' type=.In.In> origin=null + CALL 'public final fun foo (a: kotlin.Array<.In.foo>>, b: kotlin.Array<.In>): kotlin.Boolean declared in ' type=kotlin.Boolean origin=null + : + a: GET_VAR 'val a1: kotlin.Array> [val] declared in .test' type=kotlin.Array> origin=null + b: GET_VAR 'val a2: kotlin.Array> [val] declared in .test' type=kotlin.Array> origin=null diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.kt b/compiler/testData/ir/irText/types/intersectionType1_OI.kt new file mode 100644 index 00000000000..5c29c62b904 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.kt @@ -0,0 +1,17 @@ +// !LANGUAGE: -NewInference + +class In + +fun select(x: S, y: S): S = x + +fun foo(a: Array>, b: Array>) = + select(a, b)[0].ofType(true) + +inline fun In.ofType(y: Any?) = + y is K + +fun test() { + val a1 = arrayOf(In()) + val a2 = arrayOf(In()) + foo(a1, a2) +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/types/intersectionType1_OI.txt b/compiler/testData/ir/irText/types/intersectionType1_OI.txt new file mode 100644 index 00000000000..09495d38c42 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType1_OI.txt @@ -0,0 +1,72 @@ +FILE fqName: fileName:/intersectionType1_OI.kt + CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In.In> + TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> () returnType:.In.In> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:select visibility:public modality:FINAL (x:S of .select, y:S of .select) returnType:S of .select + TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:x index:0 type:S of .select + VALUE_PARAMETER name:y index:1 type:S of .select + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun select (x: S of .select, y: S of .select): S of .select declared in ' + GET_VAR 'x: S of .select declared in .select' type=S of .select origin=null + FUN name:foo visibility:public modality:FINAL (a:kotlin.Array<.In.foo>>, b:kotlin.Array<.In>) returnType:kotlin.Boolean + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:a index:0 type:kotlin.Array<.In.foo>> + VALUE_PARAMETER name:b index:1 type:kotlin.Array<.In> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (a: kotlin.Array<.In.foo>>, b: kotlin.Array<.In>): kotlin.Boolean declared in ' + CALL 'public final fun ofType (y: kotlin.Any?): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + : kotlin.Any? + $receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=.In origin=GET_ARRAY_ELEMENT + $this: CALL 'public final fun select (x: S of .select, y: S of .select): S of .select declared in ' type=kotlin.Array.In> origin=null + : kotlin.Array.In> + x: TYPE_OP type=kotlin.Array.In> origin=IMPLICIT_CAST typeOperand=kotlin.Array.In> + GET_VAR 'a: kotlin.Array<.In.foo>> declared in .foo' type=kotlin.Array<.In.foo>> origin=null + y: TYPE_OP type=kotlin.Array.In> origin=IMPLICIT_CAST typeOperand=kotlin.Array.In> + GET_VAR 'b: kotlin.Array<.In> declared in .foo' type=kotlin.Array<.In> origin=null + index: CONST Int type=kotlin.Int value=0 + y: CONST Boolean type=kotlin.Boolean value=true + FUN name:ofType visibility:public modality:FINAL ($receiver:.In.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline] + TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.In.ofType> + VALUE_PARAMETER name:y index:0 type:kotlin.Any? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun ofType (y: kotlin.Any?): kotlin.Boolean [inline] declared in ' + TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=K of .ofType + GET_VAR 'y: kotlin.Any? declared in .ofType' type=kotlin.Any? origin=null + FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + VAR name:a1 type:kotlin.Array<.In> [val] + CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array [inline] declared in kotlin' type=kotlin.Array<.In> origin=null + : .In + elements: VARARG type=kotlin.Array.In> varargElementType=.In + CALL 'public constructor () [primary] declared in .In' type=.In origin=null + : kotlin.Int + VAR name:a2 type:kotlin.Array<.In> [val] + CALL 'public final fun arrayOf (vararg elements: T of kotlin.arrayOf): kotlin.Array [inline] declared in kotlin' type=kotlin.Array<.In> origin=null + : .In + elements: VARARG type=kotlin.Array.In> varargElementType=.In + CALL 'public constructor () [primary] declared in .In' type=.In origin=null + : kotlin.String + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun foo (a: kotlin.Array<.In.foo>>, b: kotlin.Array<.In>): kotlin.Boolean declared in ' type=kotlin.Boolean origin=null + : kotlin.Int + a: GET_VAR 'val a1: kotlin.Array<.In> [val] declared in .test' type=kotlin.Array<.In> origin=null + b: GET_VAR 'val a2: kotlin.Array<.In> [val] declared in .test' type=kotlin.Array<.In> origin=null diff --git a/compiler/testData/ir/irText/types/intersectionType2.fir.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.fir.txt similarity index 99% rename from compiler/testData/ir/irText/types/intersectionType2.fir.txt rename to compiler/testData/ir/irText/types/intersectionType2_NI.fir.txt index 954baf62c6d..866817045ea 100644 --- a/compiler/testData/ir/irText/types/intersectionType2.fir.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.fir.txt @@ -1,4 +1,4 @@ -FILE fqName: fileName:/intersectionType2.kt +FILE fqName: fileName:/intersectionType2_NI.kt CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A TYPE_PARAMETER name:T index:0 variance:out superTypes:[] diff --git a/compiler/testData/ir/irText/types/intersectionType2.kt b/compiler/testData/ir/irText/types/intersectionType2_NI.kt similarity index 87% rename from compiler/testData/ir/irText/types/intersectionType2.kt rename to compiler/testData/ir/irText/types/intersectionType2_NI.kt index 16cc92a379b..ab259f9e1dd 100644 --- a/compiler/testData/ir/irText/types/intersectionType2.kt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.kt @@ -1,3 +1,5 @@ +// !LANGUAGE: +NewInference + interface A interface Foo diff --git a/compiler/testData/ir/irText/types/intersectionType2.txt b/compiler/testData/ir/irText/types/intersectionType2_NI.txt similarity index 79% rename from compiler/testData/ir/irText/types/intersectionType2.txt rename to compiler/testData/ir/irText/types/intersectionType2_NI.txt index c9a5fffa4ec..e4b0ec3bdb7 100644 --- a/compiler/testData/ir/irText/types/intersectionType2.txt +++ b/compiler/testData/ir/irText/types/intersectionType2_NI.txt @@ -1,97 +1,97 @@ -FILE fqName: fileName:/intersectionType2.kt +FILE fqName: fileName:/intersectionType2_NI.kt CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.A> + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.A> TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?] - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.Foo; .A<.B>] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B - CONSTRUCTOR visibility:public <> () returnType:.B [primary] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + CONSTRUCTOR visibility:public <> () returnType:.B [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.Foo; .A<.B>]' - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in .Foo public open fun hashCode (): kotlin.Int declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in .Foo public open fun toString (): kotlin.String declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.Foo; .A<.C>] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C - CONSTRUCTOR visibility:public <> () returnType:.C [primary] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> () returnType:.C [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.Foo; .A<.C>]' - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in .Foo public open fun hashCode (): kotlin.Int declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in .Foo public open fun toString (): kotlin.String declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:run visibility:public modality:FINAL (fn:kotlin.Function0.run>) returnType:T of .run + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:FINAL (fn:kotlin.Function0.run>) returnType:T of .run TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - VALUE_PARAMETER name:fn index:0 type:kotlin.Function0.run> + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0.run> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun run (fn: kotlin.Function0.run>): T of .run declared in ' CALL 'public abstract fun invoke (): R of kotlin.Function0 declared in kotlin.Function0' type=T of .run origin=INVOKE $this: GET_VAR 'fn: kotlin.Function0.run> declared in .run' type=kotlin.Function0.run> origin=VARIABLE_AS_FUNCTION - FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Any + FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Any BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in ' CALL 'public final fun run (fn: kotlin.Function0.run>): T of .run declared in ' type=kotlin.Any origin=null : kotlin.Any fn: BLOCK type=kotlin.Function0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Any + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Any BLOCK_BODY VAR name:mm type:.B [val] CONSTRUCTOR_CALL 'public constructor () [primary] declared in .B' type=.B origin=null - VAR name:nn type:.C [val] + VAR name:nn type:.C [val] CONSTRUCTOR_CALL 'public constructor () [primary] declared in .C' type=.C origin=null VAR name:c type:kotlin.Any [val] WHEN type=kotlin.Any origin=IF diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.fir.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.fir.txt new file mode 100644 index 00000000000..42150bbe4c7 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.fir.txt @@ -0,0 +1,100 @@ +FILE fqName: fileName:/intersectionType2_OI.kt + CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + TYPE_PARAMETER name:T index:0 variance:out superTypes:[] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.Foo; .A<.B>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + CONSTRUCTOR visibility:public <> () returnType:.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.Foo; .A<.B>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.Foo; .A<.C>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> () returnType:.C [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.Foo; .A<.C>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:FINAL (fn:kotlin.Function0) returnType:IrErrorType + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun run (fn: kotlin.Function0): IrErrorType declared in ' + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + FUN name:foo visibility:public modality:FINAL <> () returnType:IrErrorType + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (): IrErrorType declared in ' + CALL 'public final fun run (fn: kotlin.Function0): IrErrorType declared in ' type=IrErrorType origin=null + : + fn: BLOCK type=IrErrorType origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:IrErrorType + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): IrErrorType declared in .foo' + BLOCK type=.B origin=null + VAR name:mm type:.B [val] + CALL 'public constructor () [primary] declared in .B' type=.B origin=null + VAR name:nn type:.C [val] + CALL 'public constructor () [primary] declared in .C' type=.C origin=null + VAR name:c type:.B [val] + WHEN type=.B origin=IF + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'val mm: .B [val] declared in .foo.' type=.B origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'val nn: .C [val] declared in .foo.' type=.C origin=null + GET_VAR 'val c: .B [val] declared in .foo.' type=.B origin=null + FUNCTION_REFERENCE 'local final fun (): IrErrorType declared in .foo' type=IrErrorType origin=LAMBDA diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.kt b/compiler/testData/ir/irText/types/intersectionType2_OI.kt new file mode 100644 index 00000000000..92dd717aa35 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.kt @@ -0,0 +1,18 @@ +// !LANGUAGE: -NewInference + +interface A +interface Foo + +open class B : Foo, A +open class C : Foo, A + +fun run(fn: () -> T) = fn() + +fun foo() = run { + val mm = B() + val nn = C() + + val c = if (true) mm else nn + + c +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/types/intersectionType2_OI.txt b/compiler/testData/ir/irText/types/intersectionType2_OI.txt new file mode 100644 index 00000000000..adf82196ff3 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType2_OI.txt @@ -0,0 +1,106 @@ +FILE fqName: fileName:/intersectionType2_OI.kt + CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.A> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.Foo; .A<.B>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + CONSTRUCTOR visibility:public <> () returnType:.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[.Foo; .A<.B>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + public open fun hashCode (): kotlin.Int declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in .Foo + public open fun toString (): kotlin.String declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.Foo; .A<.C>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C + CONSTRUCTOR visibility:public <> () returnType:.C [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:OPEN visibility:public superTypes:[.Foo; .A<.C>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + public open fun hashCode (): kotlin.Int declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in .Foo + public open fun toString (): kotlin.String declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:FINAL (fn:kotlin.Function0.run>) returnType:T of .run + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:fn index:0 type:kotlin.Function0.run> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun run (fn: kotlin.Function0.run>): T of .run declared in ' + CALL 'public abstract fun invoke (): R of kotlin.Function0 declared in kotlin.Function0' type=T of .run origin=INVOKE + $this: GET_VAR 'fn: kotlin.Function0.run> declared in .run' type=kotlin.Function0.run> origin=VARIABLE_AS_FUNCTION + FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Any + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in ' + CALL 'public final fun run (fn: kotlin.Function0.run>): T of .run declared in ' type=kotlin.Any origin=null + : kotlin.Any + fn: BLOCK type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Any + BLOCK_BODY + VAR name:mm type:.B [val] + CALL 'public constructor () [primary] declared in .B' type=.B origin=null + VAR name:nn type:.C [val] + CALL 'public constructor () [primary] declared in .C' type=.C origin=null + VAR name:c type:kotlin.Any [val] + WHEN type=kotlin.Any origin=IF + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'val mm: .B [val] declared in .foo.' type=.B origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: GET_VAR 'val nn: .C [val] declared in .foo.' type=.C origin=null + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Any declared in .foo' + GET_VAR 'val c: kotlin.Any [val] declared in .foo.' type=kotlin.Any origin=null + FUNCTION_REFERENCE 'local final fun (): kotlin.Any declared in .foo' type=kotlin.Function0 origin=LAMBDA diff --git a/compiler/testData/ir/irText/types/intersectionType3.fir.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.fir.txt similarity index 99% rename from compiler/testData/ir/irText/types/intersectionType3.fir.txt rename to compiler/testData/ir/irText/types/intersectionType3_NI.fir.txt index 10cc4a82715..f11637e06ab 100644 --- a/compiler/testData/ir/irText/types/intersectionType3.fir.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.fir.txt @@ -1,4 +1,4 @@ -FILE fqName: fileName:/intersectionType3.kt +FILE fqName: fileName:/intersectionType3_NI.kt CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In TYPE_PARAMETER name:T index:0 variance:in superTypes:[] diff --git a/compiler/testData/ir/irText/types/intersectionType3.kt b/compiler/testData/ir/irText/types/intersectionType3_NI.kt similarity index 95% rename from compiler/testData/ir/irText/types/intersectionType3.kt rename to compiler/testData/ir/irText/types/intersectionType3_NI.kt index 825c47ad354..b4ae0fc410f 100644 --- a/compiler/testData/ir/irText/types/intersectionType3.kt +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.kt @@ -1,3 +1,5 @@ +// !LANGUAGE: +NewInference + interface In inline fun In.isT(): Boolean = diff --git a/compiler/testData/ir/irText/types/intersectionType3.txt b/compiler/testData/ir/irText/types/intersectionType3_NI.txt similarity index 78% rename from compiler/testData/ir/irText/types/intersectionType3.txt rename to compiler/testData/ir/irText/types/intersectionType3_NI.txt index 55b2a309881..2e0312403b5 100644 --- a/compiler/testData/ir/irText/types/intersectionType3.txt +++ b/compiler/testData/ir/irText/types/intersectionType3_NI.txt @@ -1,140 +1,140 @@ -FILE fqName: fileName:/intersectionType3.kt +FILE fqName: fileName:/intersectionType3_NI.kt CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In.In> + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In.In> TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?] - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:isT visibility:public modality:FINAL ($receiver:.In.isT>) returnType:kotlin.Boolean [inline] + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:isT visibility:public modality:FINAL ($receiver:.In.isT>) returnType:kotlin.Boolean [inline] TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - $receiver: VALUE_PARAMETER name: type:.In.isT> + $receiver: VALUE_PARAMETER name: type:.In.isT> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun isT (): kotlin.Boolean [inline] declared in ' TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of .isT GET_VAR ': .In.isT> declared in .isT' type=.In.isT> origin=null - FUN name:asT visibility:public modality:FINAL ($receiver:.In.asT>) returnType:kotlin.Unit [inline] + FUN name:asT visibility:public modality:FINAL ($receiver:.In.asT>) returnType:kotlin.Unit [inline] TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] - $receiver: VALUE_PARAMETER name: type:.In.asT> + $receiver: VALUE_PARAMETER name: type:.In.asT> BLOCK_BODY TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit TYPE_OP type=T of .asT origin=CAST typeOperand=T of .asT GET_VAR ': .In.asT> declared in .asT' type=.In.asT> origin=null - FUN name:sel visibility:public modality:FINAL (x:S of .sel, y:S of .sel) returnType:S of .sel + FUN name:sel visibility:public modality:FINAL (x:S of .sel, y:S of .sel) returnType:S of .sel TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?] - VALUE_PARAMETER name:x index:0 type:S of .sel - VALUE_PARAMETER name:y index:1 type:S of .sel + VALUE_PARAMETER name:x index:0 type:S of .sel + VALUE_PARAMETER name:y index:1 type:S of .sel BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' GET_VAR 'x: S of .sel declared in .sel' type=S of .sel origin=null CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS INTERFACE name:A1 modality:ABSTRACT visibility:public superTypes:[.A] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A1 - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS INTERFACE name:A2 modality:ABSTRACT visibility:public superTypes:[.A] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A2 - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in .A - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS INTERFACE name:Z1 modality:ABSTRACT visibility:public superTypes:[.A; .B] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z1 - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in .A public open fun hashCode (): kotlin.Int declared in .B - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in .A public open fun toString (): kotlin.String declared in .B - $this: VALUE_PARAMETER name: type:kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS INTERFACE name:Z2 modality:ABSTRACT visibility:public superTypes:[.A; .B] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z2 - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B - $this: VALUE_PARAMETER name: 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 + $this: VALUE_PARAMETER name: 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 overridden: public open fun hashCode (): kotlin.Int declared in .A public open fun hashCode (): kotlin.Int declared in .B - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String overridden: public open fun toString (): kotlin.String declared in .A public open fun toString (): kotlin.String declared in .B - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN name:testInIs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Boolean - VALUE_PARAMETER name:x index:0 type:.In<.A> - VALUE_PARAMETER name:y index:1 type:.In<.B> + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:testInIs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.A> + VALUE_PARAMETER name:y index:1 type:.In<.B> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testInIs1 (x: .In<.A>, y: .In<.B>): kotlin.Boolean declared in ' CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null @@ -145,9 +145,9 @@ FILE fqName: fileName:/intersectionType3.kt GET_VAR 'x: .In<.A> declared in .testInIs1' type=.In<.A> origin=null y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In GET_VAR 'y: .In<.B> declared in .testInIs1' type=.In<.B> origin=null - FUN name:testInIs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Boolean - VALUE_PARAMETER name:x index:0 type:.In<.Z1> - VALUE_PARAMETER name:y index:1 type:.In<.Z2> + FUN name:testInIs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.Z1> + VALUE_PARAMETER name:y index:1 type:.In<.Z2> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testInIs2 (x: .In<.Z1>, y: .In<.Z2>): kotlin.Boolean declared in ' CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null @@ -158,9 +158,9 @@ FILE fqName: fileName:/intersectionType3.kt GET_VAR 'x: .In<.Z1> declared in .testInIs2' type=.In<.Z1> origin=null y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In GET_VAR 'y: .In<.Z2> declared in .testInIs2' type=.In<.Z2> origin=null - FUN name:testInIs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Boolean - VALUE_PARAMETER name:x index:0 type:.In<.A1> - VALUE_PARAMETER name:y index:1 type:.In<.A2> + FUN name:testInIs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.A1> + VALUE_PARAMETER name:y index:1 type:.In<.A2> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testInIs3 (x: .In<.A1>, y: .In<.A2>): kotlin.Boolean declared in ' CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null @@ -171,9 +171,9 @@ FILE fqName: fileName:/intersectionType3.kt GET_VAR 'x: .In<.A1> declared in .testInIs3' type=.In<.A1> origin=null y: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> GET_VAR 'y: .In<.A2> declared in .testInIs3' type=.In<.A2> origin=null - FUN name:testInAs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Unit - VALUE_PARAMETER name:x index:0 type:.In<.A> - VALUE_PARAMETER name:y index:1 type:.In<.B> + FUN name:testInAs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.A> + VALUE_PARAMETER name:y index:1 type:.In<.B> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testInAs1 (x: .In<.A>, y: .In<.B>): kotlin.Unit declared in ' CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null @@ -184,9 +184,9 @@ FILE fqName: fileName:/intersectionType3.kt GET_VAR 'x: .In<.A> declared in .testInAs1' type=.In<.A> origin=null y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In GET_VAR 'y: .In<.B> declared in .testInAs1' type=.In<.B> origin=null - FUN name:testInAs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Unit - VALUE_PARAMETER name:x index:0 type:.In<.Z1> - VALUE_PARAMETER name:y index:1 type:.In<.Z2> + FUN name:testInAs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.Z1> + VALUE_PARAMETER name:y index:1 type:.In<.Z2> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testInAs2 (x: .In<.Z1>, y: .In<.Z2>): kotlin.Unit declared in ' CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null @@ -197,9 +197,9 @@ FILE fqName: fileName:/intersectionType3.kt GET_VAR 'x: .In<.Z1> declared in .testInAs2' type=.In<.Z1> origin=null y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In GET_VAR 'y: .In<.Z2> declared in .testInAs2' type=.In<.Z2> origin=null - FUN name:testInAs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Unit - VALUE_PARAMETER name:x index:0 type:.In<.A1> - VALUE_PARAMETER name:y index:1 type:.In<.A2> + FUN name:testInAs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.A1> + VALUE_PARAMETER name:y index:1 type:.In<.A2> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun testInAs3 (x: .In<.A1>, y: .In<.A2>): kotlin.Unit declared in ' CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.fir.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.fir.txt new file mode 100644 index 00000000000..a6e0736950b --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.fir.txt @@ -0,0 +1,167 @@ +FILE fqName: fileName:/intersectionType3_OI.kt + CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In + TYPE_PARAMETER name:T index:0 variance:in superTypes:[] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:isT visibility:public modality:FINAL () returnType:kotlin.Boolean [inline] + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun isT (): kotlin.Boolean [inline] declared in ' + TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of .isT + ERROR_CALL 'Unresolved reference: this#' type=.In.isT> + FUN name:asT visibility:public modality:FINAL () returnType:kotlin.Unit [inline] + TYPE_PARAMETER name:T index:0 variance: superTypes:[] + BLOCK_BODY + TYPE_OP type=T of .asT origin=CAST typeOperand=T of .asT + ERROR_CALL 'Unresolved reference: this#' type=.In.asT> + FUN name:sel visibility:public modality:FINAL (x:S of .sel, y:S of .sel) returnType:S of .sel + TYPE_PARAMETER name:S index:0 variance: superTypes:[] + VALUE_PARAMETER name:x index:0 type:S of .sel + VALUE_PARAMETER name:y index:1 type:S of .sel + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' + GET_VAR 'x: S of .sel declared in .sel' type=S of .sel origin=null + CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:A1 modality:ABSTRACT visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:A2 modality:ABSTRACT visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Z1 modality:ABSTRACT visibility:public superTypes:[.A; .B] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Z2 modality:ABSTRACT visibility:public superTypes:[.A; .B] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:testInIs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.A> + VALUE_PARAMETER name:y index:1 type:.In<.B> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInIs1 (x: .In<.A>, y: .In<.B>): kotlin.Boolean declared in ' + CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + : + FUN name:testInIs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.Z1> + VALUE_PARAMETER name:y index:1 type:.In<.Z2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInIs2 (x: .In<.Z1>, y: .In<.Z2>): kotlin.Boolean declared in ' + CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + : + FUN name:testInIs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.A1> + VALUE_PARAMETER name:y index:1 type:.In<.A2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInIs3 (x: .In<.A1>, y: .In<.A2>): kotlin.Boolean declared in ' + CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + : + FUN name:testInAs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.A> + VALUE_PARAMETER name:y index:1 type:.In<.B> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInAs1 (x: .In<.A>, y: .In<.B>): kotlin.Unit declared in ' + CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null + : + FUN name:testInAs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.Z1> + VALUE_PARAMETER name:y index:1 type:.In<.Z2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInAs2 (x: .In<.Z1>, y: .In<.Z2>): kotlin.Unit declared in ' + CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null + : + FUN name:testInAs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.A1> + VALUE_PARAMETER name:y index:1 type:.In<.A2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInAs3 (x: .In<.A1>, y: .In<.A2>): kotlin.Unit declared in ' + CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null + : diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.kt b/compiler/testData/ir/irText/types/intersectionType3_OI.kt new file mode 100644 index 00000000000..97edb5d35bf --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.kt @@ -0,0 +1,32 @@ +// !LANGUAGE: -NewInference + +interface In + +inline fun In.isT(): Boolean = + this is T + +inline fun In.asT() { this as T } + +fun sel(x: S, y: S): S = x + +interface A +interface B + +interface A1 : A +interface A2 : A + +interface Z1 : A, B +interface Z2 : A, B + + +fun testInIs1(x: In, y: In) = sel(x, y).isT() + +fun testInIs2(x: In, y: In) = sel(x, y).isT() + +fun testInIs3(x: In, y: In) = sel(x, y).isT() + +fun testInAs1(x: In, y: In) = sel(x, y).asT() + +fun testInAs2(x: In, y: In) = sel(x, y).asT() + +fun testInAs3(x: In, y: In) = sel(x, y).asT() diff --git a/compiler/testData/ir/irText/types/intersectionType3_OI.txt b/compiler/testData/ir/irText/types/intersectionType3_OI.txt new file mode 100644 index 00000000000..814dd2a9da9 --- /dev/null +++ b/compiler/testData/ir/irText/types/intersectionType3_OI.txt @@ -0,0 +1,212 @@ +FILE fqName: fileName:/intersectionType3_OI.kt + CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In.In> + TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?] + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:isT visibility:public modality:FINAL ($receiver:.In.isT>) returnType:kotlin.Boolean [inline] + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.In.isT> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun isT (): kotlin.Boolean [inline] declared in ' + TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of .isT + GET_VAR ': .In.isT> declared in .isT' type=.In.isT> origin=null + FUN name:asT visibility:public modality:FINAL ($receiver:.In.asT>) returnType:kotlin.Unit [inline] + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.In.asT> + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + TYPE_OP type=T of .asT origin=CAST typeOperand=T of .asT + GET_VAR ': .In.asT> declared in .asT' type=.In.asT> origin=null + FUN name:sel visibility:public modality:FINAL (x:S of .sel, y:S of .sel) returnType:S of .sel + TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?] + VALUE_PARAMETER name:x index:0 type:S of .sel + VALUE_PARAMETER name:y index:1 type:S of .sel + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' + GET_VAR 'x: S of .sel declared in .sel' type=S of .sel origin=null + CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.B + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:A1 modality:ABSTRACT visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:A2 modality:ABSTRACT visibility:public superTypes:[.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in .A + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Z1 modality:ABSTRACT visibility:public superTypes:[.A; .B] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in .A + public open fun hashCode (): kotlin.Int declared in .B + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in .A + public open fun toString (): kotlin.String declared in .B + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Z2 modality:ABSTRACT visibility:public superTypes:[.A; .B] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .A + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .B + $this: VALUE_PARAMETER name: 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 + overridden: + public open fun hashCode (): kotlin.Int declared in .A + public open fun hashCode (): kotlin.Int declared in .B + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in .A + public open fun toString (): kotlin.String declared in .B + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:testInIs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.A> + VALUE_PARAMETER name:y index:1 type:.In<.B> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInIs1 (x: .In<.A>, y: .In<.B>): kotlin.Boolean declared in ' + CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + : kotlin.Any + $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null + : .In + x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'x: .In<.A> declared in .testInIs1' type=.In<.A> origin=null + y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'y: .In<.B> declared in .testInIs1' type=.In<.B> origin=null + FUN name:testInIs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.Z1> + VALUE_PARAMETER name:y index:1 type:.In<.Z2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInIs2 (x: .In<.Z1>, y: .In<.Z2>): kotlin.Boolean declared in ' + CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + : kotlin.Any + $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null + : .In + x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'x: .In<.Z1> declared in .testInIs2' type=.In<.Z1> origin=null + y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'y: .In<.Z2> declared in .testInIs2' type=.In<.Z2> origin=null + FUN name:testInIs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Boolean + VALUE_PARAMETER name:x index:0 type:.In<.A1> + VALUE_PARAMETER name:y index:1 type:.In<.A2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInIs3 (x: .In<.A1>, y: .In<.A2>): kotlin.Boolean declared in ' + CALL 'public final fun isT (): kotlin.Boolean [inline] declared in ' type=kotlin.Boolean origin=null + : .A + $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In<.A> origin=null + : .In<.A> + x: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> + GET_VAR 'x: .In<.A1> declared in .testInIs3' type=.In<.A1> origin=null + y: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> + GET_VAR 'y: .In<.A2> declared in .testInIs3' type=.In<.A2> origin=null + FUN name:testInAs1 visibility:public modality:FINAL <> (x:.In<.A>, y:.In<.B>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.A> + VALUE_PARAMETER name:y index:1 type:.In<.B> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInAs1 (x: .In<.A>, y: .In<.B>): kotlin.Unit declared in ' + CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null + : kotlin.Any + $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null + : .In + x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'x: .In<.A> declared in .testInAs1' type=.In<.A> origin=null + y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'y: .In<.B> declared in .testInAs1' type=.In<.B> origin=null + FUN name:testInAs2 visibility:public modality:FINAL <> (x:.In<.Z1>, y:.In<.Z2>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.Z1> + VALUE_PARAMETER name:y index:1 type:.In<.Z2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInAs2 (x: .In<.Z1>, y: .In<.Z2>): kotlin.Unit declared in ' + CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null + : kotlin.Any + $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In origin=null + : .In + x: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'x: .In<.Z1> declared in .testInAs2' type=.In<.Z1> origin=null + y: TYPE_OP type=.In origin=IMPLICIT_CAST typeOperand=.In + GET_VAR 'y: .In<.Z2> declared in .testInAs2' type=.In<.Z2> origin=null + FUN name:testInAs3 visibility:public modality:FINAL <> (x:.In<.A1>, y:.In<.A2>) returnType:kotlin.Unit + VALUE_PARAMETER name:x index:0 type:.In<.A1> + VALUE_PARAMETER name:y index:1 type:.In<.A2> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun testInAs3 (x: .In<.A1>, y: .In<.A2>): kotlin.Unit declared in ' + CALL 'public final fun asT (): kotlin.Unit [inline] declared in ' type=kotlin.Unit origin=null + : .A + $receiver: CALL 'public final fun sel (x: S of .sel, y: S of .sel): S of .sel declared in ' type=.In<.A> origin=null + : .In<.A> + x: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> + GET_VAR 'x: .In<.A1> declared in .testInAs3' type=.In<.A1> origin=null + y: TYPE_OP type=.In<.A> origin=IMPLICIT_CAST typeOperand=.In<.A> + GET_VAR 'y: .In<.A2> declared in .testInAs3' type=.In<.A2> origin=null diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType.fir.txt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.fir.txt similarity index 99% rename from compiler/testData/ir/irText/types/localVariableOfIntersectionType.fir.txt rename to compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.fir.txt index 01d0850211e..2f37898d026 100644 --- a/compiler/testData/ir/irText/types/localVariableOfIntersectionType.fir.txt +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.fir.txt @@ -1,4 +1,4 @@ -FILE fqName: fileName:/localVariableOfIntersectionType.kt +FILE fqName: fileName:/localVariableOfIntersectionType_NI.kt CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In TYPE_PARAMETER name:T index:0 variance:in superTypes:[] diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType.kt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt similarity index 53% rename from compiler/testData/ir/irText/types/localVariableOfIntersectionType.kt rename to compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt index b3cd92daeca..f5cb91539b5 100644 --- a/compiler/testData/ir/irText/types/localVariableOfIntersectionType.kt +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt @@ -1,4 +1,11 @@ // !LANGUAGE: +NewInference +// With -NewInference we have +// TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS: Type inference failed: Cannot infer type parameter T in fun create(x: In, y: In): Inv +// None of the following substitutions +// (In,In) +// (In,In) +// can be applied to +// (In,In) interface In diff --git a/compiler/testData/ir/irText/types/localVariableOfIntersectionType.txt b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.txt similarity index 99% rename from compiler/testData/ir/irText/types/localVariableOfIntersectionType.txt rename to compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.txt index 728302d8111..7377f55eaf3 100644 --- a/compiler/testData/ir/irText/types/localVariableOfIntersectionType.txt +++ b/compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.txt @@ -1,4 +1,4 @@ -FILE fqName: fileName:/localVariableOfIntersectionType.kt +FILE fqName: fileName:/localVariableOfIntersectionType_NI.kt CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.In.In> TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?] diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 156fb1c1223..160db98128d 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1606,24 +1606,39 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/ir/irText/types"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("intersectionType1.kt") - public void testIntersectionType1() throws Exception { - runTest("compiler/testData/ir/irText/types/intersectionType1.kt"); + @TestMetadata("intersectionType1_NI.kt") + public void testIntersectionType1_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType1_NI.kt"); } - @TestMetadata("intersectionType2.kt") - public void testIntersectionType2() throws Exception { - runTest("compiler/testData/ir/irText/types/intersectionType2.kt"); + @TestMetadata("intersectionType1_OI.kt") + public void testIntersectionType1_OI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType1_OI.kt"); } - @TestMetadata("intersectionType3.kt") - public void testIntersectionType3() throws Exception { - runTest("compiler/testData/ir/irText/types/intersectionType3.kt"); + @TestMetadata("intersectionType2_NI.kt") + public void testIntersectionType2_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType2_NI.kt"); } - @TestMetadata("localVariableOfIntersectionType.kt") - public void testLocalVariableOfIntersectionType() throws Exception { - runTest("compiler/testData/ir/irText/types/localVariableOfIntersectionType.kt"); + @TestMetadata("intersectionType2_OI.kt") + public void testIntersectionType2_OI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType2_OI.kt"); + } + + @TestMetadata("intersectionType3_NI.kt") + public void testIntersectionType3_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType3_NI.kt"); + } + + @TestMetadata("intersectionType3_OI.kt") + public void testIntersectionType3_OI() throws Exception { + runTest("compiler/testData/ir/irText/types/intersectionType3_OI.kt"); + } + + @TestMetadata("localVariableOfIntersectionType_NI.kt") + public void testLocalVariableOfIntersectionType_NI() throws Exception { + runTest("compiler/testData/ir/irText/types/localVariableOfIntersectionType_NI.kt"); } } }