Fix inferred type of FirGetClassCall
The inferred type should be `KClass<out Blah>` for `FirGetClassCall` invoked on expressions.
This commit is contained in:
committed by
teamcityserver
parent
7bb81ef157
commit
d4717569b9
+2
-2
@@ -7,8 +7,8 @@ FILE: test.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
private final val klass: R|java/lang/Class<MyTest>| = <getClass>(this@R|/MyTest|).R|kotlin/jvm/java|<R|MyTest|>
|
||||
private get(): R|java/lang/Class<MyTest>|
|
||||
private final val klass: R|java/lang/Class<out MyTest>| = <getClass>(this@R|/MyTest|).R|kotlin/jvm/java|<R|MyTest|>
|
||||
private get(): R|java/lang/Class<out MyTest>|
|
||||
|
||||
private final val logger: R|ft<Logger, Logger?>| = Q|Logger|.R|/Logger.getInstance|(this@R|/MyTest|.R|/MyTest.klass|)
|
||||
private get(): R|ft<Logger, Logger?>|
|
||||
|
||||
+6
-1
@@ -759,7 +759,12 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
||||
symbol.constructType(emptyArray(), isNullable = false)
|
||||
}
|
||||
else -> {
|
||||
lhs.resultType.coneType
|
||||
val resultType = lhs.resultType
|
||||
if (resultType is FirErrorTypeRef) {
|
||||
resultType.coneType
|
||||
} else {
|
||||
ConeKotlinTypeProjectionOut(resultType.coneType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import kotlin.reflect.KClass
|
||||
class Foo {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other === null || <!EQUALITY_NOT_APPLICABLE!>other::class != this::class<!>) return false
|
||||
if (other === null || other::class != this::class) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ fun foo(
|
||||
aListInt: A<List<Int>>,
|
||||
aSetInt: A<Set<Int>>,
|
||||
aListString: A<List<String>>,
|
||||
|
||||
mutableListAny: MutableList<Any>,
|
||||
listString: List<String>,
|
||||
) {
|
||||
"a" == "b"
|
||||
1 == 2
|
||||
@@ -94,4 +97,6 @@ fun foo(
|
||||
|
||||
<!EQUALITY_NOT_APPLICABLE_WARNING!>aString == aListString<!>
|
||||
<!EQUALITY_NOT_APPLICABLE_WARNING!>bString == aListString<!>
|
||||
|
||||
<!EQUALITY_NOT_APPLICABLE_WARNING!>mutableListAny == listString<!>
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ fun foo(
|
||||
aListInt: A<List<Int>>,
|
||||
aSetInt: A<Set<Int>>,
|
||||
aListString: A<List<String>>,
|
||||
|
||||
mutableListAny: MutableList<Any>,
|
||||
listString: List<String>,
|
||||
) {
|
||||
"a" == "b"
|
||||
1 == 2
|
||||
@@ -94,4 +97,6 @@ fun foo(
|
||||
|
||||
aString == aListString
|
||||
bString == aListString
|
||||
|
||||
mutableListAny == listString
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
class A {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test() {
|
||||
A::class /*~> Unit */
|
||||
A()::class /*~> Unit */
|
||||
A::class.<get-java><A>() /*~> Unit */
|
||||
A()::class.<get-java><A>() /*~> Unit */
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
FILE fqName:<root> fileName:/classReference.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A 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 [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CLASS_REFERENCE 'CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<<root>.A>
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
GET_CLASS type=kotlin.reflect.KClass<<root>.A>
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public final fun <get-java> <T> (): java.lang.Class<T of kotlin.jvm.JvmClassMappingKt.<get-java>> declared in kotlin.jvm.JvmClassMappingKt' type=java.lang.Class<<root>.A> origin=GET_PROPERTY
|
||||
<T>: <root>.A
|
||||
$receiver: CLASS_REFERENCE 'CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<<root>.A>
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public final fun <get-java> <T> (): java.lang.Class<T of kotlin.jvm.JvmClassMappingKt.<get-java>> declared in kotlin.jvm.JvmClassMappingKt' type=java.lang.Class<<root>.A> origin=GET_PROPERTY
|
||||
<T>: <root>.A
|
||||
$receiver: GET_CLASS type=kotlin.reflect.KClass<<root>.A>
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
//WITH_RUNTIME
|
||||
class A
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
class A {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
}
|
||||
|
||||
val qux: Int
|
||||
field = 1
|
||||
get
|
||||
|
||||
val test1: KClass<A>
|
||||
field = A::class
|
||||
get
|
||||
|
||||
val test2: KClass<Int>
|
||||
field = <get-qux>()::class
|
||||
get
|
||||
|
||||
val test3: KFunction1<A, Unit>
|
||||
field = A::foo
|
||||
get
|
||||
|
||||
val test4: KFunction0<A>
|
||||
field = A::<init>
|
||||
get
|
||||
|
||||
val test5: KFunction0<Unit>
|
||||
field = A()::foo
|
||||
get
|
||||
|
||||
val test6: KFunction0<Unit>
|
||||
field = ::bar
|
||||
get
|
||||
@@ -1,90 +0,0 @@
|
||||
FILE fqName:<root> fileName:/reflectionLiterals.kt
|
||||
CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.A [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN name:foo visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.A
|
||||
BLOCK_BODY
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:bar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
PROPERTY name:qux visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:qux type:kotlin.Int visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value=1
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-qux> visibility:public modality:FINAL <> () returnType:kotlin.Int
|
||||
correspondingProperty: PROPERTY name:qux visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-qux> (): kotlin.Int declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:qux type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null
|
||||
PROPERTY name:test1 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.reflect.KClass<<root>.A> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CLASS_REFERENCE 'CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<<root>.A>
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KClass<<root>.A>
|
||||
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test1> (): kotlin.reflect.KClass<<root>.A> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.reflect.KClass<<root>.A> visibility:private [final,static]' type=kotlin.reflect.KClass<<root>.A> origin=null
|
||||
PROPERTY name:test2 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.reflect.KClass<kotlin.Int> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
GET_CLASS type=kotlin.reflect.KClass<kotlin.Int>
|
||||
CALL 'public final fun <get-qux> (): kotlin.Int declared in <root>' type=kotlin.Int origin=GET_PROPERTY
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KClass<kotlin.Int>
|
||||
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test2> (): kotlin.reflect.KClass<kotlin.Int> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.reflect.KClass<kotlin.Int> visibility:private [final,static]' type=kotlin.reflect.KClass<kotlin.Int> origin=null
|
||||
PROPERTY name:test3 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.reflect.KFunction1<<root>.A, kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>.A' type=kotlin.reflect.KFunction1<<root>.A, kotlin.Unit> origin=null reflectionTarget=<same>
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction1<<root>.A, kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): kotlin.reflect.KFunction1<<root>.A, kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.reflect.KFunction1<<root>.A, kotlin.Unit> visibility:private [final,static]' type=kotlin.reflect.KFunction1<<root>.A, kotlin.Unit> origin=null
|
||||
PROPERTY name:test4 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.reflect.KFunction0<<root>.A> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUNCTION_REFERENCE 'public constructor <init> () [primary] declared in <root>.A' type=kotlin.reflect.KFunction0<<root>.A> origin=null reflectionTarget=<same>
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test4> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0<<root>.A>
|
||||
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test4> (): kotlin.reflect.KFunction0<<root>.A> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.reflect.KFunction0<<root>.A> visibility:private [final,static]' type=kotlin.reflect.KFunction0<<root>.A> origin=null
|
||||
PROPERTY name:test5 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.reflect.KFunction0<kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in <root>.A' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A' type=<root>.A origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test5> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0<kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:test5 visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test5> (): kotlin.reflect.KFunction0<kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.reflect.KFunction0<kotlin.Unit> visibility:private [final,static]' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null
|
||||
PROPERTY name:test6 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:test6 type:kotlin.reflect.KFunction0<kotlin.Unit> visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
FUNCTION_REFERENCE 'public final fun bar (): kotlin.Unit declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null reflectionTarget=<same>
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test6> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0<kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:test6 visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-test6> (): kotlin.reflect.KFunction0<kotlin.Unit> declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test6 type:kotlin.reflect.KFunction0<kotlin.Unit> visibility:private [final,static]' type=kotlin.reflect.KFunction0<kotlin.Unit> origin=null
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class A {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ FILE fqName:<root> fileName:/readWriteProperty.kt
|
||||
<class: T>: <root>.SettingType<kotlin.Int>
|
||||
t: CONSTRUCTOR_CALL 'public constructor <init> (type: kotlin.reflect.KClass<out V of <root>.SettingType>) [primary] declared in <root>.SettingType' type=<root>.SettingType<kotlin.Int> origin=null
|
||||
<class: V>: kotlin.Int
|
||||
type: GET_CLASS type=kotlin.reflect.KClass<kotlin.Int>
|
||||
type: GET_CLASS type=kotlin.reflect.KClass<out kotlin.Int>
|
||||
CONST Int type=kotlin.Int value=42
|
||||
v: CONST Int type=kotlin.Int value=42
|
||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-projectTemplate> visibility:public modality:FINAL <> ($this:<root>.IdeWizard) returnType:kotlin.Int?
|
||||
@@ -168,7 +168,7 @@ FILE fqName:<root> fileName:/readWriteProperty.kt
|
||||
<set-?>: TYPE_OP type=T of <root>.IdeWizard.setting origin=CAST typeOperand=T of <root>.IdeWizard.setting
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (type: kotlin.reflect.KClass<out V of <root>.SettingType>) [primary] declared in <root>.SettingType' type=<root>.SettingType<V of <root>.IdeWizard.setting> origin=null
|
||||
<class: V>: V of <root>.IdeWizard.setting
|
||||
type: GET_CLASS type=kotlin.reflect.KClass<V of <root>.IdeWizard.setting>
|
||||
type: GET_CLASS type=kotlin.reflect.KClass<out V of <root>.IdeWizard.setting>
|
||||
GET_VAR 'value: V of <root>.IdeWizard.setting? declared in <root>.IdeWizard.setting.<no name provided>.setValue' type=V of <root>.IdeWizard.setting? origin=null
|
||||
CALL 'public final fun <set-v> (<set-?>: V of <root>.SettingReference): kotlin.Unit declared in <root>.SettingReference' type=kotlin.Unit origin=EQ
|
||||
$this: GET_VAR 'reference: <root>.SettingReference<V of <root>.IdeWizard.setting, T of <root>.IdeWizard.setting> declared in <root>.IdeWizard.setting' type=<root>.SettingReference<V of <root>.IdeWizard.setting, T of <root>.IdeWizard.setting> origin=null
|
||||
|
||||
Reference in New Issue
Block a user