From 39d4b79324bf7302d77705415599854b85101436 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Sun, 2 Aug 2020 17:16:21 +0300 Subject: [PATCH] [FIR TEST] Fix FE 1.0 / FIR test data for nested / local type alias case --- .../typealias/inheritedNestedTypeAlias.fir.kt | 20 +++++++++++++++++++ .../typealias/inheritedNestedTypeAlias.kt | 3 +-- .../tests/typealias/localTypeAlias.fir.kt | 19 ++++++++++++++++++ .../tests/typealias/localTypeAlias.kt | 7 +++---- 4 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt create mode 100644 compiler/testData/diagnostics/tests/typealias/localTypeAlias.fir.kt diff --git a/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt new file mode 100644 index 00000000000..1f9518bf269 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.fir.kt @@ -0,0 +1,20 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY + +interface ICell { + val x: T +} + +class Cell(override val x: T): ICell + +open class Base { + typealias CT = Cell + inner class InnerCell(override val x: T): ICell +} + +class Derived : Base() { + val x1: InnerCell = InnerCell(42) + val x2: Base.InnerCell = InnerCell(42) + + val test1: CT = Cell(42) + val test2: Base.CT = Cell(42) +} diff --git a/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt index 7469809ca78..d0e84053c88 100644 --- a/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/typealias/inheritedNestedTypeAlias.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY interface ICell { @@ -16,6 +15,6 @@ class Derived : Base() { val x1: InnerCell = InnerCell(42) val x2: Base.InnerCell = InnerCell(42) - val test1: CT = Cell(42) + val test1: CT = Cell(42) val test2: Base.CT = Cell(42) } diff --git a/compiler/testData/diagnostics/tests/typealias/localTypeAlias.fir.kt b/compiler/testData/diagnostics/tests/typealias/localTypeAlias.fir.kt new file mode 100644 index 00000000000..080b05dc681 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typealias/localTypeAlias.fir.kt @@ -0,0 +1,19 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY + +fun emptyList(): List = null!! + +fun foo() { + typealias LT = List + + val a: LT = emptyList() + + fun localFun(): LT { + typealias LLT = List + + val b: LLT = a + + return b + } + + localFun() +} diff --git a/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt b/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt index f9c1d6232bf..a7c55d93331 100644 --- a/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/typealias/localTypeAlias.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY fun emptyList(): List = null!! @@ -6,12 +5,12 @@ fun emptyList(): List = null!! fun foo() { typealias LT = List - val a: LT = emptyList() + val a: LT = emptyList() - fun localFun(): LT { + fun localFun(): LT { typealias LLT = List - val b: LLT = a + val b: LLT = a return b }