FIR: Change the Fir2Ir handling of smart casts.

Generate the expression with the original type and then insert
an implicit conversion. That matches the behavior of psi2ir
better and therefore avoids breaking backend assumptions.

In particular, IrGetValue expects the type of the underlying
symbol and the type of the IrGetValue to be the same.
This commit is contained in:
Mads Ager
2020-01-30 11:25:06 +01:00
committed by max-kammerer
parent d68a1898d0
commit e8a640851a
48 changed files with 285 additions and 404 deletions
@@ -23,4 +23,5 @@ FILE fqName:<root> fileName:/castFromAny.kt
GET_VAR 'a: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null
CALL 'public abstract fun invoke (): kotlin.Unit declared in <root>.KRunnable' type=kotlin.Unit origin=null
$this: CALL 'public final fun KRunnable (block: kotlin.Function0<kotlin.Unit>): <root>.KRunnable declared in <root>' type=<root>.KRunnable origin=null
block: GET_VAR 'a: kotlin.Any? declared in <root>.test' type=kotlin.Function0<kotlin.Unit> origin=null
block: TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: kotlin.Any? declared in <root>.test' type=kotlin.Any? origin=null