FIR: Do not copy type parameters from class to constructors

Use the same instances from class declaration instead

Otherwise, primary constructor value parameter types when used
in the class body are considered as different from types
based on the class type parameters

See the test genericConstructors.kt, before this commit
"id" call was reported in inapplicable
This commit is contained in:
Denis Zharkov
2019-12-05 13:08:51 +03:00
parent 20d02dd0ee
commit b8984d154b
46 changed files with 212 additions and 153 deletions
@@ -2,15 +2,15 @@ FILE fqName:<root> fileName:/genericClassInDifferentModule_m1.kt
CLASS CLASS name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Base
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
CONSTRUCTOR visibility:public <> (x:T of <uninitialized parent>) returnType:<root>.Base<T of <uninitialized parent>> [primary]
VALUE_PARAMETER name:x index:0 type:T of <uninitialized parent>
CONSTRUCTOR visibility:public <> (x:T of <root>.Base) returnType:<root>.Base<T of <root>.Base> [primary]
VALUE_PARAMETER name:x index:0 type:T of <root>.Base
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
PROPERTY name:x visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:x type:T of <root>.Base visibility:private [final]
EXPRESSION_BODY
GET_VAR 'x: T of <uninitialized parent> declared in <root>.Base.<init>' type=T of <uninitialized parent> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
GET_VAR 'x: T of <root>.Base declared in <root>.Base.<init>' type=T of <root>.Base origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:T of <root>.Base
correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Base