diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/LoggerInstance.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/LoggerInstance.fir.txt index 8bed91fdeef..6725333eb56 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/LoggerInstance.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/LoggerInstance.fir.txt @@ -7,8 +7,8 @@ FILE: test.kt super() } - private final val klass: R|java/lang/Class| = (this@R|/MyTest|).R|kotlin/jvm/java| - private get(): R|java/lang/Class| + private final val klass: R|java/lang/Class| = (this@R|/MyTest|).R|kotlin/jvm/java| + private get(): R|java/lang/Class| private final val logger: R|ft| = Q|Logger|.R|/Logger.getInstance|(this@R|/MyTest|.R|/MyTest.klass|) private get(): R|ft| diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index d59a6a597ee..cc164225d4b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -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) + } } } diff --git a/compiler/testData/diagnostics/tests/classLiteral/smartCast.fir.kt b/compiler/testData/diagnostics/tests/classLiteral/smartCast.fir.kt index 817b380c0b6..7ab9924cefa 100644 --- a/compiler/testData/diagnostics/tests/classLiteral/smartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/classLiteral/smartCast.fir.kt @@ -5,7 +5,7 @@ import kotlin.reflect.KClass class Foo { override fun equals(other: Any?): Boolean { if (this === other) return true - if (other === null || other::class != this::class) return false + if (other === null || other::class != this::class) return false return true } diff --git a/compiler/testData/diagnostics/tests/enum/typeCompatibility.fir.kt b/compiler/testData/diagnostics/tests/enum/typeCompatibility.fir.kt index 0189311b6df..dc682e1ca99 100644 --- a/compiler/testData/diagnostics/tests/enum/typeCompatibility.fir.kt +++ b/compiler/testData/diagnostics/tests/enum/typeCompatibility.fir.kt @@ -47,6 +47,9 @@ fun foo( aListInt: A>, aSetInt: A>, aListString: A>, + + mutableListAny: MutableList, + listString: List, ) { "a" == "b" 1 == 2 @@ -94,4 +97,6 @@ fun foo( aString == aListString bString == aListString + + mutableListAny == listString } diff --git a/compiler/testData/diagnostics/tests/enum/typeCompatibility.kt b/compiler/testData/diagnostics/tests/enum/typeCompatibility.kt index bf68f636d1e..27b6467ae6a 100644 --- a/compiler/testData/diagnostics/tests/enum/typeCompatibility.kt +++ b/compiler/testData/diagnostics/tests/enum/typeCompatibility.kt @@ -47,6 +47,9 @@ fun foo( aListInt: A>, aSetInt: A>, aListString: A>, + + mutableListAny: MutableList, + listString: List, ) { "a" == "b" 1 == 2 @@ -94,4 +97,6 @@ fun foo( aString == aListString bString == aListString + + mutableListAny == listString } diff --git a/compiler/testData/ir/irText/expressions/classReference.fir.kt.txt b/compiler/testData/ir/irText/expressions/classReference.fir.kt.txt deleted file mode 100644 index e03a82adcb7..00000000000 --- a/compiler/testData/ir/irText/expressions/classReference.fir.kt.txt +++ /dev/null @@ -1,15 +0,0 @@ -class A { - constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - -} - -fun test() { - A::class /*~> Unit */ - A()::class /*~> Unit */ - A::class.() /*~> Unit */ - A()::class.() /*~> Unit */ -} diff --git a/compiler/testData/ir/irText/expressions/classReference.fir.txt b/compiler/testData/ir/irText/expressions/classReference.fir.txt deleted file mode 100644 index b86c24890c3..00000000000 --- a/compiler/testData/ir/irText/expressions/classReference.fir.txt +++ /dev/null @@ -1,36 +0,0 @@ -FILE fqName: fileName:/classReference.kt - CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A - CONSTRUCTOR visibility:public <> () returnType:.A [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [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: 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: 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: 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<.A> - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - GET_CLASS type=kotlin.reflect.KClass<.A> - CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' type=.A origin=null - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm.JvmClassMappingKt' type=java.lang.Class<.A> origin=GET_PROPERTY - : .A - $receiver: CLASS_REFERENCE 'CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.A> - TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit - CALL 'public final fun (): java.lang.Class> declared in kotlin.jvm.JvmClassMappingKt' type=java.lang.Class<.A> origin=GET_PROPERTY - : .A - $receiver: GET_CLASS type=kotlin.reflect.KClass<.A> - CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' type=.A origin=null diff --git a/compiler/testData/ir/irText/expressions/classReference.kt b/compiler/testData/ir/irText/expressions/classReference.kt index 4ba32de63e2..467ac2f7167 100644 --- a/compiler/testData/ir/irText/expressions/classReference.kt +++ b/compiler/testData/ir/irText/expressions/classReference.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL //WITH_RUNTIME class A diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.kt.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.kt.txt deleted file mode 100644 index 13152677fbc..00000000000 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.kt.txt +++ /dev/null @@ -1,42 +0,0 @@ -class A { - constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - - fun foo() { - } - -} - -fun bar() { -} - -val qux: Int - field = 1 - get - -val test1: KClass - field = A::class - get - -val test2: KClass - field = ()::class - get - -val test3: KFunction1 - field = A::foo - get - -val test4: KFunction0 - field = A:: - get - -val test5: KFunction0 - field = A()::foo - get - -val test6: KFunction0 - field = ::bar - get diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.txt b/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.txt deleted file mode 100644 index cef9c290d56..00000000000 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.fir.txt +++ /dev/null @@ -1,90 +0,0 @@ -FILE fqName: fileName:/reflectionLiterals.kt - CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A - CONSTRUCTOR visibility:public <> () returnType:.A [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [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:.A) returnType:kotlin.Unit - $this: VALUE_PARAMETER name: type:.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: 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: 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: 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: 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 (): kotlin.Int declared in ' - 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<.A> visibility:private [final,static] - EXPRESSION_BODY - CLASS_REFERENCE 'CLASS CLASS name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.A> - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KClass<.A> - correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val] - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KClass<.A> declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test1 type:kotlin.reflect.KClass<.A> visibility:private [final,static]' type=kotlin.reflect.KClass<.A> origin=null - PROPERTY name:test2 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.reflect.KClass visibility:private [final,static] - EXPRESSION_BODY - GET_CLASS type=kotlin.reflect.KClass - CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=GET_PROPERTY - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KClass - correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val] - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KClass declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.reflect.KClass visibility:private [final,static]' type=kotlin.reflect.KClass origin=null - PROPERTY name:test3 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.reflect.KFunction1<.A, kotlin.Unit> visibility:private [final,static] - EXPRESSION_BODY - FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in .A' type=kotlin.reflect.KFunction1<.A, kotlin.Unit> origin=null reflectionTarget= - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction1<.A, kotlin.Unit> - correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [val] - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KFunction1<.A, kotlin.Unit> declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test3 type:kotlin.reflect.KFunction1<.A, kotlin.Unit> visibility:private [final,static]' type=kotlin.reflect.KFunction1<.A, kotlin.Unit> origin=null - PROPERTY name:test4 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.reflect.KFunction0<.A> visibility:private [final,static] - EXPRESSION_BODY - FUNCTION_REFERENCE 'public constructor () [primary] declared in .A' type=kotlin.reflect.KFunction0<.A> origin=null reflectionTarget= - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0<.A> - correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [val] - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KFunction0<.A> declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test4 type:kotlin.reflect.KFunction0<.A> visibility:private [final,static]' type=kotlin.reflect.KFunction0<.A> origin=null - PROPERTY name:test5 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.reflect.KFunction0 visibility:private [final,static] - EXPRESSION_BODY - FUNCTION_REFERENCE 'public final fun foo (): kotlin.Unit declared in .A' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= - $this: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .A' type=.A origin=null - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0 - correspondingProperty: PROPERTY name:test5 visibility:public modality:FINAL [val] - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KFunction0 declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test5 type:kotlin.reflect.KFunction0 visibility:private [final,static]' type=kotlin.reflect.KFunction0 origin=null - PROPERTY name:test6 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test6 type:kotlin.reflect.KFunction0 visibility:private [final,static] - EXPRESSION_BODY - FUNCTION_REFERENCE 'public final fun bar (): kotlin.Unit declared in ' type=kotlin.reflect.KFunction0 origin=null reflectionTarget= - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction0 - correspondingProperty: PROPERTY name:test6 visibility:public modality:FINAL [val] - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KFunction0 declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test6 type:kotlin.reflect.KFunction0 visibility:private [final,static]' type=kotlin.reflect.KFunction0 origin=null diff --git a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt index ec7e4f36a2b..80b2d462a2a 100644 --- a/compiler/testData/ir/irText/expressions/reflectionLiterals.kt +++ b/compiler/testData/ir/irText/expressions/reflectionLiterals.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { fun foo() {} } diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt index ae0aba9fcfe..de0f38ef6b5 100644 --- a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt @@ -110,7 +110,7 @@ FILE fqName: fileName:/readWriteProperty.kt : .SettingType t: CONSTRUCTOR_CALL 'public constructor (type: kotlin.reflect.KClass.SettingType>) [primary] declared in .SettingType' type=.SettingType origin=null : kotlin.Int - type: GET_CLASS type=kotlin.reflect.KClass + type: GET_CLASS type=kotlin.reflect.KClass CONST Int type=kotlin.Int value=42 v: CONST Int type=kotlin.Int value=42 FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.IdeWizard) returnType:kotlin.Int? @@ -168,7 +168,7 @@ FILE fqName: fileName:/readWriteProperty.kt : TYPE_OP type=T of .IdeWizard.setting origin=CAST typeOperand=T of .IdeWizard.setting CONSTRUCTOR_CALL 'public constructor (type: kotlin.reflect.KClass.SettingType>) [primary] declared in .SettingType' type=.SettingType.IdeWizard.setting> origin=null : V of .IdeWizard.setting - type: GET_CLASS type=kotlin.reflect.KClass.IdeWizard.setting> + type: GET_CLASS type=kotlin.reflect.KClass.IdeWizard.setting> GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null CALL 'public final fun (: V of .SettingReference): kotlin.Unit declared in .SettingReference' type=kotlin.Unit origin=EQ $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null