Underlying constructor for type alias should always be substituted

Otherwise PSI2IR fails because of type mismatch.
This commit is contained in:
Dmitry Petrov
2018-03-16 17:11:24 +03:00
parent bfcf1584a2
commit eb5904ea8e
8 changed files with 81 additions and 15 deletions
@@ -0,0 +1,5 @@
class Cell<T>(val value: T)
typealias IntAlias = Cell<Int>
fun test() = IntAlias(42)
@@ -0,0 +1,43 @@
FILE fqName:<root> fileName:/specializedTypeAliasConstructorCall.kt
CLASS CLASS name:Cell modality:FINAL visibility:public flags:
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:Cell<T> flags:
superClasses:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Any?]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public flags:
CONSTRUCTOR visibility:public <> (value:T) returnType:Cell<T> flags:
VALUE_PARAMETER name:value index:0 type:T flags:
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
INSTANCE_INITIALIZER_CALL classDescriptor='Cell'
PROPERTY name:value type:T visibility:public modality:FINAL flags:val
FIELD PROPERTY_BACKING_FIELD name:value type:T visibility:public
EXPRESSION_BODY
GET_VAR 'value-parameter value: T' type=T origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-value> visibility:public modality:FINAL <> ($this:Cell<T>) returnType:T flags:
$this: VALUE_PARAMETER name:<this> type:Cell<T> flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='<get-value>(): T'
GET_FIELD 'value: T' type=T origin=null
receiver: GET_VAR 'this@Cell: Cell<T>' type=Cell<T> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:Boolean flags:
overridden:
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:Boolean flags:
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
VALUE_PARAMETER name:other index:0 type:kotlin.Any? flags:
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:Int flags:
overridden:
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:Int flags:
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:String flags:
overridden:
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:String flags:
$this: VALUE_PARAMETER name:<this> type:kotlin.Any flags:
TYPEALIAS typealias IntAlias = Cell<Int> type=Cell<kotlin.Int>
FUN name:test visibility:public modality:FINAL <> () returnType:Cell<Int> flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='test(): IntAlias /* = Cell<Int> */'
CALL 'constructor Cell(Int)' type=Cell<kotlin.Int> origin=null
<T>: null
value: CONST Int type=kotlin.Int value=42