More precise implicit cast generation

If an expression 'x' has a definitely non-null type 'T1',
and is used in position with an expected type 'T2',
cast 'x' to 'T2!!' (most common non-null type T*: T* <: T2).
This commit is contained in:
Dmitry Petrov
2018-02-02 11:11:09 +03:00
parent 9137e68d4e
commit bf18186045
4 changed files with 26 additions and 20 deletions
@@ -16,7 +16,7 @@ FILE fqName:<root> fileName:/Derived.kt
then: BLOCK type=kotlin.Unit origin=null
SET_FIELD 'value: String!' type=kotlin.Unit origin=EQ
receiver: GET_VAR 'this@Derived: Derived' type=Derived origin=null
value: TYPE_OP type=kotlin.String! origin=IMPLICIT_CAST typeOperand=kotlin.String!
value: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
GET_VAR 'value-parameter v: Any' type=kotlin.Any origin=null
PROPERTY FAKE_OVERRIDE name:value type:kotlin.String! visibility:public modality:FINAL flags:var
FIELD FAKE_OVERRIDE name:value type:kotlin.String! visibility:public