[FIR] Add implementation of intersection types to Fir type system

This commit is contained in:
Dmitriy Novozhilov
2019-07-29 09:59:33 +03:00
parent 1708a34eb8
commit 637fb55a7b
17 changed files with 350 additions and 26 deletions
@@ -34,7 +34,7 @@ FILE fqName:<root> fileName:/intersectionType1_NI.kt
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>'
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
$receiver: CALL 'public final fun get (index: kotlin.Int): <root>.In<T of <root>.foo> declared in kotlin.Array' type=<root>.In<T of <root>.foo> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<T of <root>.foo>> origin=null
<S>: <none>
x: GET_VAR 'a: kotlin.Array<<root>.In<T of <root>.foo>> declared in <root>.foo' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
y: GET_VAR 'b: kotlin.Array<<root>.In<kotlin.String>> declared in <root>.foo' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
@@ -34,7 +34,7 @@ FILE fqName:<root> fileName:/intersectionType1_OI.kt
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>'
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
$receiver: CALL 'public final fun get (index: kotlin.Int): <root>.In<T of <root>.foo> declared in kotlin.Array' type=<root>.In<T of <root>.foo> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<T of <root>.foo>> origin=null
<S>: <none>
x: GET_VAR 'a: kotlin.Array<<root>.In<T of <root>.foo>> declared in <root>.foo' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
y: GET_VAR 'b: kotlin.Array<<root>.In<kotlin.String>> declared in <root>.foo' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
@@ -75,24 +75,24 @@ FILE fqName:<root> fileName:/intersectionType2_NI.kt
RETURN type=kotlin.Nothing from='public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>'
CALL 'public abstract fun invoke (): T of <root>.run declared in kotlin.Function0' type=T of <root>.run origin=null
$this: GET_VAR 'fn: kotlin.Function0<T of <root>.run> declared in <root>.run' type=kotlin.Function0<T of <root>.run> origin=null
FUN name:foo visibility:public modality:FINAL <> () returnType:<root>.B
FUN name:foo visibility:public modality:FINAL <> () returnType:<root>.Foo
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): <root>.B declared in <root>'
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=<root>.B origin=null
RETURN type=kotlin.Nothing from='public final fun foo (): <root>.Foo declared in <root>'
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=<root>.Foo origin=null
<T>: <none>
fn: FUN_EXPR type=kotlin.Function0<<root>.B> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.B
fn: FUN_EXPR type=kotlin.Function0<<root>.Foo> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.Foo
BLOCK_BODY
VAR name:mm type:<root>.B [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.B' type=<root>.B origin=null
VAR name:nn type:<root>.C [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.C' type=<root>.C origin=null
VAR name:c type:<root>.B [val]
WHEN type=<root>.B origin=IF
VAR name:c type:<root>.Foo [val]
WHEN type=<root>.Foo origin=IF
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val mm: <root>.B [val] declared in <root>.foo.<anonymous>' type=<root>.B origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val nn: <root>.C [val] declared in <root>.foo.<anonymous>' type=<root>.C origin=null
GET_VAR 'val c: <root>.B [val] declared in <root>.foo.<anonymous>' type=<root>.B origin=null
GET_VAR 'val c: <root>.Foo [val] declared in <root>.foo.<anonymous>' type=<root>.Foo origin=null
@@ -75,24 +75,24 @@ FILE fqName:<root> fileName:/intersectionType2_OI.kt
RETURN type=kotlin.Nothing from='public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>'
CALL 'public abstract fun invoke (): T of <root>.run declared in kotlin.Function0' type=T of <root>.run origin=null
$this: GET_VAR 'fn: kotlin.Function0<T of <root>.run> declared in <root>.run' type=kotlin.Function0<T of <root>.run> origin=null
FUN name:foo visibility:public modality:FINAL <> () returnType:<root>.B
FUN name:foo visibility:public modality:FINAL <> () returnType:<root>.Foo
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): <root>.B declared in <root>'
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=<root>.B origin=null
RETURN type=kotlin.Nothing from='public final fun foo (): <root>.Foo declared in <root>'
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=<root>.Foo origin=null
<T>: <none>
fn: FUN_EXPR type=kotlin.Function0<<root>.B> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.B
fn: FUN_EXPR type=kotlin.Function0<<root>.Foo> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.Foo
BLOCK_BODY
VAR name:mm type:<root>.B [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.B' type=<root>.B origin=null
VAR name:nn type:<root>.C [val]
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.C' type=<root>.C origin=null
VAR name:c type:<root>.B [val]
WHEN type=<root>.B origin=IF
VAR name:c type:<root>.Foo [val]
WHEN type=<root>.Foo origin=IF
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val mm: <root>.B [val] declared in <root>.foo.<anonymous>' type=<root>.B origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val nn: <root>.C [val] declared in <root>.foo.<anonymous>' type=<root>.C origin=null
GET_VAR 'val c: <root>.B [val] declared in <root>.foo.<anonymous>' type=<root>.B origin=null
GET_VAR 'val c: <root>.Foo [val] declared in <root>.foo.<anonymous>' type=<root>.Foo origin=null