compiler testdata: s/trait/interface
This commit is contained in:
@@ -8,7 +8,7 @@ fun test(foo: Foo) {
|
||||
}
|
||||
|
||||
//variable as member
|
||||
trait A {
|
||||
interface A {
|
||||
val foo: Foo
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ fun test(a: A) {
|
||||
}
|
||||
|
||||
//variable as extension
|
||||
trait B {
|
||||
interface B {
|
||||
}
|
||||
val B.foo: Foo
|
||||
get() = Foo()
|
||||
@@ -36,9 +36,9 @@ fun test(b: B) {
|
||||
}
|
||||
|
||||
//variable as member extension
|
||||
trait C
|
||||
interface C
|
||||
|
||||
trait D {
|
||||
interface D {
|
||||
val C.foo: Foo
|
||||
|
||||
fun test(c: C) {
|
||||
|
||||
@@ -8,7 +8,7 @@ fun test(foo: Foo) {
|
||||
}
|
||||
|
||||
//variable as member
|
||||
trait A {
|
||||
interface A {
|
||||
val foo: Foo
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ fun test(a: A) {
|
||||
}
|
||||
|
||||
//variable as extension
|
||||
trait B {}
|
||||
interface B {}
|
||||
val B.foo: Foo
|
||||
get() = Foo()
|
||||
|
||||
@@ -35,9 +35,9 @@ fun test(b: B) {
|
||||
}
|
||||
|
||||
//variable as member extension
|
||||
trait C
|
||||
interface C
|
||||
|
||||
trait D {
|
||||
interface D {
|
||||
val C.foo: Foo
|
||||
|
||||
fun test(c: C) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Foo
|
||||
|
||||
//no variable
|
||||
trait A {
|
||||
interface A {
|
||||
fun Foo.invoke() {}
|
||||
|
||||
fun test(foo: Foo) {
|
||||
@@ -10,7 +10,7 @@ trait A {
|
||||
}
|
||||
|
||||
//variable as member
|
||||
trait B {
|
||||
interface B {
|
||||
val foo: Foo
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ fun test(c: C, b: B) {
|
||||
|
||||
|
||||
//variable as extension,
|
||||
trait D {
|
||||
interface D {
|
||||
}
|
||||
val D.foo: Foo
|
||||
get() = Foo()
|
||||
@@ -66,9 +66,9 @@ fun test(e: E, d: D) {
|
||||
}
|
||||
|
||||
//variable as member extension
|
||||
trait F
|
||||
interface F
|
||||
|
||||
trait G {
|
||||
interface G {
|
||||
val F.foo: Foo
|
||||
fun Foo.invoke()
|
||||
|
||||
@@ -92,13 +92,13 @@ fun test(g: G, f: F) {
|
||||
}
|
||||
|
||||
//variable as member extension (2)
|
||||
trait X
|
||||
interface X
|
||||
|
||||
trait U {
|
||||
interface U {
|
||||
val X.foo: Foo
|
||||
}
|
||||
|
||||
trait V {
|
||||
interface V {
|
||||
fun Foo.invoke() {}
|
||||
|
||||
fun U.test(x: X) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
trait A
|
||||
trait Foo {
|
||||
interface A
|
||||
interface Foo {
|
||||
fun A.invoke()
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ enum class DOMElementTestClasses {
|
||||
|
||||
|
||||
// use case 2
|
||||
trait EnumStyleClass {
|
||||
interface EnumStyleClass {
|
||||
fun invoke() {}
|
||||
}
|
||||
enum class TestClasses : EnumStyleClass {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait A
|
||||
interface A
|
||||
|
||||
fun foo(invoke: A.()->Unit, a: A) {
|
||||
a.invoke()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
trait Foo<T>
|
||||
interface Foo<T>
|
||||
|
||||
class Bar {
|
||||
fun <T> invoke(): Foo<T> = throw Exception()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
trait Inv<I>
|
||||
interface Inv<I>
|
||||
|
||||
fun <S, T: S> Inv<T>.reduce2(): S = null!!
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package a
|
||||
|
||||
trait A
|
||||
interface A
|
||||
fun doList(l: List<Int>) = l
|
||||
fun doInt(i: Int) = i
|
||||
fun getList(): List<Int>? = null
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package a
|
||||
|
||||
trait A
|
||||
interface A
|
||||
|
||||
fun <T>id(t: T): T = t
|
||||
fun doList(l: List<Int>) = l
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
trait A
|
||||
trait B
|
||||
interface A
|
||||
interface B
|
||||
|
||||
trait C: A, B
|
||||
trait D: A, B
|
||||
trait E: A, B
|
||||
interface C: A, B
|
||||
interface D: A, B
|
||||
interface E: A, B
|
||||
|
||||
fun foo(c: C?, d: D?, e: E?) {
|
||||
val a: A? = <!TYPE_MISMATCH!>c ?: d<!> ?: e
|
||||
|
||||
Reference in New Issue
Block a user