[FIR] Don't approximate captured types
This fixes some type argument mismatch errors caused by a captured type being approximated and then captured again. Some places need to be adapted to work with captured types that previously only worked with approximated types. #KT-62959 Fixed
This commit is contained in:
committed by
Space Team
parent
b6d7f35ebf
commit
251827c9aa
@@ -2,9 +2,6 @@
|
||||
// ISSUE: KT-52838
|
||||
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
// IGNORE_BACKEND_K2: WASM
|
||||
// REASON: That still doesn't work properly with PCLA, but accidentally don't fails for other tests but WASM
|
||||
// (see KT-52838 for tracking and same-named diagnostic test)
|
||||
|
||||
fun box(): String {
|
||||
build {
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
// ISSUE: KT-52838
|
||||
// JVM_ABI_K1_K2_DIFF: KT-64738
|
||||
|
||||
// IGNORE_BACKEND_K2: WASM
|
||||
// REASON: That still doesn't work properly with PCLA, but accidentally don't fails for other tests but WASM
|
||||
// (see KT-52838 for tracking and same-named diagnostic test)
|
||||
|
||||
fun box(): String {
|
||||
build {
|
||||
this as DerivedBuildee<*>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
MODULE main
|
||||
Missing in K2
|
||||
TestKt$example$2.class
|
||||
CLASS TestKt$example$1.class
|
||||
Property: class.signature
|
||||
K1
|
||||
Lkotlin/jvm/internal/Lambda;Lkotlin/jvm/functions/Function1<*Lkotlin/Unit;>;
|
||||
K2
|
||||
NULL
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
MODULE main
|
||||
Missing in K1
|
||||
_1Kt$sam$Consumer$0.class
|
||||
CLASS User$use$1.class
|
||||
Property: class.signature
|
||||
K1
|
||||
<T:Ljava/lang/Object;>Ljava/lang/Object;LConsumer;
|
||||
K2
|
||||
NULL
|
||||
Property: class.superClassInternalName
|
||||
K1
|
||||
java/lang/Object
|
||||
K2
|
||||
kotlin/jvm/internal/Lambda
|
||||
Property: class.superInterfaces
|
||||
K1
|
||||
[Consumer]
|
||||
K2
|
||||
[kotlin/jvm/functions/Function1]
|
||||
K1
|
||||
consume(Ljava/lang/Object;)V [public, final]
|
||||
K2
|
||||
---
|
||||
K1
|
||||
---
|
||||
K2
|
||||
invoke(Ljava/lang/Object;)V [public, final]
|
||||
FIELD INSTANCE:LUser$use$1;
|
||||
Property: field.signature
|
||||
K1
|
||||
LUser$use$1<TT;>;
|
||||
K2
|
||||
NULL
|
||||
@@ -3,6 +3,7 @@
|
||||
// SAM_CONVERSIONS: CLASS
|
||||
// ^ test checks reflection for synthetic classes
|
||||
// MODULE: lib
|
||||
// JVM_ABI_K1_K2_DIFF: KT-64954
|
||||
// FILE: Promise.java
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
MODULE main
|
||||
Missing in K1
|
||||
BoxKt$test$2.class
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FULL_JDK
|
||||
// JVM_TARGET: 1.8
|
||||
// JVM_ABI_K1_K2_DIFF: KT-64954
|
||||
// FILE: J.java
|
||||
|
||||
import java.util.function.*;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// ISSUE: KT-62959
|
||||
|
||||
fun bar(x: Inv<out CharSequence>) {
|
||||
x.foo { <!ARGUMENT_TYPE_MISMATCH("CapturedType(out kotlin.CharSequence); kotlin.CharSequence")!>it<!> }
|
||||
x.bar { <!ARGUMENT_TYPE_MISMATCH("CapturedType(out kotlin.CharSequence); kotlin.CharSequence"), TYPE_MISMATCH("CapturedType(out kotlin.CharSequence); CapturedType(out kotlin.CharSequence)")!>it.e()<!> }
|
||||
x.foo { it }
|
||||
x.bar { it.e() }
|
||||
}
|
||||
|
||||
interface Inv<E> {
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@ class Bound<T: Number>(val value: T)
|
||||
|
||||
fun test_1() {
|
||||
val b: Bound<in Int> = Bound(1)
|
||||
val vl: Number = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number")!>b.value<!>
|
||||
val vl: Number = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(in kotlin.Int)")!>b.value<!>
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val b: Bound<*> = Bound(1)
|
||||
val vl: Number = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number")!>b.value<!>
|
||||
val vl: Number = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)")!>b.value<!>
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
interface Inv<T : CharSequence>
|
||||
|
||||
fun <E : CharSequence> id(i: Inv<E>): Inv<E> = i
|
||||
|
||||
fun foo1(x: Inv<in String>) {
|
||||
val y = <!DEBUG_INFO_EXPRESSION_TYPE("Inv<CapturedType(in kotlin.String)>")!>id(x)<!> // Should return Inv<in String>
|
||||
bar1(y)
|
||||
}
|
||||
|
||||
fun bar1(i: Inv<in String>) {}
|
||||
|
||||
fun foo2(x: Inv<in Nothing>) {
|
||||
// Inv<out kotlin.CharSequence> is OK here, because it's still a subtype of Inv<in Nothing>
|
||||
val y = <!DEBUG_INFO_EXPRESSION_TYPE("Inv<CapturedType(in kotlin.Nothing)>")!>id(x)<!>
|
||||
bar2(y)
|
||||
}
|
||||
|
||||
fun bar2(i: Inv<in Nothing>) {}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
interface Inv<T : CharSequence>
|
||||
|
||||
fun <E : CharSequence> id(i: Inv<E>): Inv<E> = i
|
||||
|
||||
compiler/testData/diagnostics/tests/inference/capturedTypes/captureFromNullableTypeInScopeAny.fir.kt
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// ISSUE: KT-57958
|
||||
|
||||
fun ListVM<*>.foo() {
|
||||
val currentItem1: MutableProperty<out Any?> = <!DEBUG_INFO_EXPRESSION_TYPE("MutableProperty<CapturedType(*)?>")!>currentItem<!>
|
||||
}
|
||||
|
||||
interface MutableProperty<T> {
|
||||
var value: T
|
||||
}
|
||||
|
||||
interface ListVM<TItemVM> {
|
||||
val currentItem: MutableProperty<TItemVM?>
|
||||
}
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-57958
|
||||
|
||||
fun ListVM<*>.foo() {
|
||||
|
||||
+5
-5
@@ -20,11 +20,11 @@ fun getTag7(): Tag7<*> = Tag7<Int> { }
|
||||
fun getTag8(): Tag8<*> = Tag8<Int> { 1 }
|
||||
|
||||
fun main() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Nothing, kotlin.Unit>")!>getTag().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Nothing, kotlin.Unit>")!>getTag2().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Nothing, kotlin.Unit>")!>getTag3().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Nothing, kotlin.Unit>")!>getTag4().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Nothing, kotlin.Any?>")!>getTag5().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action<CapturedType(*)>")!>getTag().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action<in CapturedType(*)>")!>getTag2().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action<CapturedType(*)>")!>getTag3().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action<in CapturedType(*)>")!>getTag4().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action2<CapturedType(*)>")!>getTag5().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action<in kotlin.Any?>")!>getTag6().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action<kotlin.Any?>")!>getTag7().action<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Action2<kotlin.Any?>")!>getTag8().action<!>
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
// FILE: Inlay.java
|
||||
public interface Inlay<T extends EditorCustomElementRenderer> {
|
||||
@org.jetbrains.annotations.NotNull T getRenderer();
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
interface EditorCustomElementRenderer
|
||||
interface PresentationContainerRenderer<Constraints : Any> : EditorCustomElementRenderer
|
||||
|
||||
fun test(inlay: Inlay<out PresentationContainerRenderer<*>>) {
|
||||
inlay.renderer.addOrUpdate()
|
||||
}
|
||||
|
||||
fun <T : Any> PresentationContainerRenderer<T>.addOrUpdate() {}
|
||||
@@ -44,7 +44,7 @@ public class Bar<T> {
|
||||
|
||||
fun takeStarBar(x: Bar<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main2() {
|
||||
@@ -58,7 +58,7 @@ fun main2() {
|
||||
|
||||
fun takeStarFoo2(x: Foo2<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main3() {
|
||||
@@ -75,7 +75,7 @@ public class Bar2<T> {
|
||||
|
||||
fun takeStarBar2(x: Bar2<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main4() {
|
||||
@@ -89,7 +89,7 @@ fun main4() {
|
||||
|
||||
fun takeStarFoo3(x: Foo3<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main5() {
|
||||
@@ -107,7 +107,7 @@ class Bar3<T> {
|
||||
|
||||
fun takeStarBar3(x: Bar3<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main6() {
|
||||
|
||||
+5
-5
@@ -44,7 +44,7 @@ public class Bar<T> {
|
||||
|
||||
fun takeStarBar(x: Bar<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main2() {
|
||||
@@ -58,7 +58,7 @@ fun main2() {
|
||||
|
||||
fun takeStarFoo2(x: Foo2<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main3() {
|
||||
@@ -75,7 +75,7 @@ public class Bar2<T> {
|
||||
|
||||
fun takeStarBar2(x: Bar2<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main4() {
|
||||
@@ -89,7 +89,7 @@ fun main4() {
|
||||
|
||||
fun takeStarFoo3(x: Foo3<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main5() {
|
||||
@@ -107,7 +107,7 @@ class Bar3<T> {
|
||||
|
||||
fun takeStarBar3(x: Bar3<*>) {
|
||||
x.value = <!ASSIGNMENT_TYPE_MISMATCH!>"test"<!>
|
||||
x.value <!UNRESOLVED_REFERENCE!>+=<!> "test"
|
||||
x.value <!NONE_APPLICABLE!>+=<!> "test"
|
||||
}
|
||||
|
||||
fun main6() {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
class A<T> {
|
||||
fun foo(): T = null!!
|
||||
}
|
||||
|
||||
fun <E> A<E>.bar(): A<in E> = this
|
||||
|
||||
fun baz(x: A<out CharSequence>) {
|
||||
x.bar() checkType { _<A<*>>() }
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(in CapturedType(out kotlin.CharSequence))")!>x.bar().foo()<!> checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() } // See KT-10448
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(in CapturedType(out kotlin.CharSequence))")!>x.bar().foo()<!> checkType { _<CharSequence>() } // Inference change in K2
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
class A<T> {
|
||||
@@ -9,5 +8,6 @@ fun <E> A<E>.bar(): A<in E> = this
|
||||
|
||||
fun baz(x: A<out CharSequence>) {
|
||||
x.bar() checkType { _<A<*>>() }
|
||||
x.bar().foo() checkType { _<Any?>() } // See KT-10448
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x.bar().foo()<!> checkType { _<Any?>() } // See KT-10448
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x.bar().foo()<!> checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><CharSequence>() } // Inference change in K2
|
||||
}
|
||||
|
||||
+6
-6
@@ -19,17 +19,17 @@ public class JavaWriterAppender {
|
||||
|
||||
// FILE: main.kt
|
||||
fun test() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("WriterAppender.Builder1<*>")!>WriterAppender.newBuilder()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("WriterAppender.Builder1<out WriterAppender.Builder1<*>>")!>WriterAppender.Builder1()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)")!>WriterAppender.newBuilder()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("WriterAppender.Builder1<CapturedType(*)>")!>WriterAppender.Builder1()<!>
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("WriterAppender.Builder1<*> & WriterAppender.Builder2<*>")!>WriterAppender.intersectTwoSelfTypes()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)")!>WriterAppender.intersectTwoSelfTypes()<!>
|
||||
}
|
||||
|
||||
fun testJava(appender: JavaWriterAppender) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("JavaWriterAppender.Builder1<*>..JavaWriterAppender.Builder1<*>?!")!>appender.newBuilder()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("JavaWriterAppender.Builder1<out JavaWriterAppender.Builder1<*>..JavaWriterAppender.Builder1<*>?!>")!>appender.Builder1()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)!!..CapturedType(*)?!")!>appender.newBuilder()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("JavaWriterAppender.Builder1<CapturedType(*)>")!>appender.Builder1()<!>
|
||||
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("JavaWriterAppender.Builder1<*> & JavaWriterAppender.Builder2<*>..JavaWriterAppender.Builder1<*>? & JavaWriterAppender.Builder2<*>?")!>appender.intersectTwoSelfTypes()<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)!!..CapturedType(*)?!")!>appender.intersectTwoSelfTypes()<!>
|
||||
}
|
||||
|
||||
object WriterAppender {
|
||||
|
||||
+12
-12
@@ -65,17 +65,17 @@ fun test10(b: Boolean) {
|
||||
}
|
||||
|
||||
fun test11(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>foo11 { 1 }.value<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out kotlin.Any)")!>foo11 { 1 }.value<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>foo11 { 2 }.value<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out kotlin.Any)")!>foo11 { 2 }.value<!>
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
|
||||
fun test12(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>foo12 { 1 }.value.value<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out kotlin.Any)")!>foo12 { 1 }.value.value<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>foo12 { 2 }.value.value<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out kotlin.Any)")!>foo12 { 2 }.value.value<!>
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
@@ -91,17 +91,17 @@ fun test20(b: Boolean) {
|
||||
}
|
||||
|
||||
fun test21(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo21 { 1 }.value<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo21 { 1 }.value<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo21 { 2 }.value<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo21 { 2 }.value<!>
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
|
||||
fun test22(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo22 { 1 }.value.value<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo22 { 1 }.value.value<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo22 { 2 }.value.value<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo22 { 2 }.value.value<!>
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
@@ -117,17 +117,17 @@ fun test30(b: Boolean) {
|
||||
}
|
||||
|
||||
fun test31(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo31 { 1 }.value<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo31 { 1 }.value<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo31 { 2 }.value<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo31 { 2 }.value<!>
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
|
||||
fun test32(b: Boolean) {
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo32 { 1 }.value.value<!>
|
||||
var x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo32 { 1 }.value.value<!>
|
||||
if (b) {
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("I1")!>foo32 { 2 }.value.value<!>
|
||||
x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(out I1)")!>foo32 { 2 }.value.value<!>
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>bar<!>()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
abstract class FirBasedSymbol<E : FirDeclaration> {
|
||||
val fir: E get() = null!!
|
||||
}
|
||||
abstract class FirCallableSymbol<D : FirCallableDeclaration> : FirBasedSymbol<D>()
|
||||
|
||||
sealed class FirDeclaration
|
||||
sealed class FirCallableDeclaration : FirDeclaration()
|
||||
|
||||
class FirFunction : FirCallableDeclaration()
|
||||
class FirVariable : FirCallableDeclaration()
|
||||
|
||||
val FirCallableSymbol<*>.isExtension: Boolean
|
||||
get() = when (fir) {
|
||||
is FirFunction -> true
|
||||
is FirVariable -> false
|
||||
}
|
||||
+2
-2
@@ -10,6 +10,6 @@ fun <T> listOf(): List<T> = null!!
|
||||
// Unresolved reference is ok here:
|
||||
// we can't create a substituted signature for type alias constructor
|
||||
// since it has 'out' type projection in 'in' position.
|
||||
val test1 = BOutIn(<!ARGUMENT_TYPE_MISMATCH!>listOf()<!>, null!!)
|
||||
val test1 = <!UPPER_BOUND_VIOLATED!>BOutIn(<!ARGUMENT_TYPE_MISMATCH!>listOf()<!>, null!!)<!>
|
||||
|
||||
val test2 = BInIn(listOf(), null!!)
|
||||
val test2 = <!UPPER_BOUND_VIOLATED!>BInIn(listOf(), null!!)<!>
|
||||
|
||||
+7
-6
@@ -7,7 +7,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
CALL 'public open fun someFunction (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=example.Hello<out @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=example.Hello<out @[FlexibleNullability] kotlin.String?>
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.Nothing?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
@@ -17,7 +17,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): @[FlexibleNullability] example.SomeJavaClass<@[FlexibleNullability] A of example.SomeJavaClass?>? declared in example.SomeJavaClass' type=@[FlexibleNullability] example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>? origin=PLUS
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=example.Hello<out @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=example.Hello<out @[FlexibleNullability] kotlin.String?>
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.Nothing?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
@@ -26,7 +26,7 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
CALL 'public open fun get (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=example.Hello<out @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=example.Hello<out @[FlexibleNullability] kotlin.String?>
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.Nothing?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
@@ -36,17 +36,18 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): @[FlexibleNullability] example.SomeJavaClass<@[FlexibleNullability] A of example.SomeJavaClass?>? declared in example.SomeJavaClass' type=@[FlexibleNullability] example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>? origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=example.Hello<out @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=example.Hello<out @[FlexibleNullability] kotlin.String?>
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.Nothing?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun set (i: kotlin.Int, hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
$this: TYPE_OP type=example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?> origin=IMPLICIT_CAST typeOperand=example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>
|
||||
GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
i: CONST Int type=kotlin.Int value=0
|
||||
hello: TYPE_OP type=example.Hello<out @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=example.Hello<out @[FlexibleNullability] kotlin.String?>
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.Nothing?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ fun test() {
|
||||
return Unit
|
||||
}
|
||||
/*-> Hello<out @FlexibleNullability String?> */)
|
||||
a.set(i = 0, hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
a /*as SomeJavaClass<out @FlexibleNullability String?> */.set(i = 0, hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> Hello<out @FlexibleNullability String?> */)
|
||||
|
||||
@@ -76,7 +76,7 @@ FILE fqName:<root> fileName:/genericFunWithStar.kt
|
||||
VALUE_PARAMETER name:serializers index:0 type:kotlin.Array<out <root>.I<*>> varargElementType:<root>.I<*> [vararg]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun bar (vararg serializers: <root>.I<*>): <root>.I<*> declared in <root>.Box'
|
||||
CALL 'public abstract fun foo <F> (tSerializer: <root>.I<F of <root>.Box.foo>): <root>.I<<root>.Box<F of <root>.Box.foo>> declared in <root>.Box' type=<root>.I<out <root>.Box<*>> origin=null
|
||||
CALL 'public abstract fun foo <F> (tSerializer: <root>.I<F of <root>.Box.foo>): <root>.I<<root>.Box<F of <root>.Box.foo>> declared in <root>.Box' type=<root>.I<out <root>.Box<out <root>.IBase>> origin=null
|
||||
<F>: <root>.IBase
|
||||
$this: GET_VAR '<this>: <root>.Box<T of <root>.Box> declared in <root>.Box.bar' type=<root>.Box<T of <root>.Box> origin=null
|
||||
tSerializer: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array declared in kotlin.Array' type=<root>.I<*> origin=null
|
||||
|
||||
Reference in New Issue
Block a user