Fir2Ir: properly compute setter type parameter bounds

This commit is contained in:
Georgy Bronnikov
2022-05-02 13:30:06 +03:00
committed by Alexander Udalov
parent 3a4b8962f9
commit 8fd29a9fec
4 changed files with 2 additions and 58 deletions
@@ -115,7 +115,7 @@ class Fir2IrClassifierStorage(
getIrTypeParameter(typeParameter, index, symbol, typeContext).apply {
parent = this@setTypeParameters
if (superTypes.isEmpty()) {
superTypes = typeParameter.bounds.map { it.toIrType() }
superTypes = typeParameter.bounds.map { it.toIrType(typeContext) }
}
}
}
@@ -1,40 +0,0 @@
FILE fqName:<root> fileName:/typeParameterBeforeBound.kt
CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test1<T of <root>.Test1, U of <root>.Test1>
TYPE_PARAMETER name:T index:0 variance: superTypes:[U of <root>.Test1] reified:false
TYPE_PARAMETER name:U index:1 variance: superTypes:[kotlin.Any?] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.Test1<T of <root>.Test1, U of <root>.Test1> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 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:test2 visibility:public modality:FINAL <T, U> () returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[U of <root>.test2] reified:false
TYPE_PARAMETER name:U index:1 variance: superTypes:[kotlin.Any?] reified:false
BLOCK_BODY
PROPERTY name:test3 visibility:public modality:FINAL [var]
FUN name:<get-test3> visibility:public modality:FINAL <T, U> ($receiver:<root>.Test1<T of <root>.<get-test3>, U of <root>.<get-test3>>) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [var]
TYPE_PARAMETER name:T index:0 variance: superTypes:[U of <root>.<get-test3>] reified:false
TYPE_PARAMETER name:U index:1 variance: superTypes:[kotlin.Any?] reified:false
$receiver: VALUE_PARAMETER name:<this> type:<root>.Test1<T of <root>.<get-test3>, U of <root>.<get-test3>>
BLOCK_BODY
FUN name:<set-test3> visibility:public modality:FINAL <T, U> ($receiver:<root>.Test1<T of <root>.<get-test3>, U of <root>.<get-test3>>, value:kotlin.Unit) returnType:kotlin.Unit
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [var]
TYPE_PARAMETER name:T index:0 variance: superTypes:[U of <root>.<get-test3>] reified:false
TYPE_PARAMETER name:U index:1 variance: superTypes:[kotlin.Any?] reified:false
$receiver: VALUE_PARAMETER name:<this> type:<root>.Test1<T of <root>.<get-test3>, U of <root>.<get-test3>>
VALUE_PARAMETER name:value index:0 type:kotlin.Unit
BLOCK_BODY
@@ -1,17 +0,0 @@
class Test1<T : U, U : Any?> {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
fun <T : U, U : Any?> test2() {
}
var <T : U, U : Any?> Test1<T, U>.test3: Unit
get() {
}
set(value: Unit) {
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Test1<T : U, U>
fun <T : U, U> test2() {}