Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed

This commit is contained in:
Mikhail Glukhikh
2020-03-04 17:54:33 +03:00
parent 186e0b0cba
commit 8884cbe415
2268 changed files with 1175 additions and 19754 deletions
@@ -1,33 +0,0 @@
class B
class A {
operator fun B.invoke() = 4
}
class X {
operator fun invoke() = 3
}
fun test(a: A, b: B) {
with (a) {
b()
(b)()
}
X()()
val x = X()
x()
(x)()
}
fun test(c: () -> String, e: Int.() -> String) {
c()
(c)()
3.e()
3.(e)()
with(3) {
e()
(e)()
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class B
class A {
@@ -1,61 +0,0 @@
class Foo {}
operator fun Foo.invoke() {}
//no variable
fun test(foo: Foo) {
foo()
}
//variable as member
interface A {
val foo: Foo
}
fun test(a: A) {
a.foo()
with (a) {
foo()
}
}
//variable as extension
interface B {
}
val B.foo: Foo
get() = Foo()
fun test(b: B) {
b.foo()
with (b) {
foo()
}
}
//variable as member extension
interface C
interface D {
val C.foo: Foo
fun test(c: C) {
c.foo()
with (c) {
foo()
}
}
}
fun test(d: D, c: C) {
with (d) {
c.foo()
with (c) {
foo()
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Foo {}
operator fun Foo.invoke() {}
@@ -1,60 +0,0 @@
class Foo {
operator fun invoke() {}
}
//no variable
fun test(foo: Foo) {
foo()
}
//variable as member
interface A {
val foo: Foo
}
fun test(a: A) {
a.foo()
with (a) {
foo()
}
}
//variable as extension
interface B {}
val B.foo: Foo
get() = Foo()
fun test(b: B) {
b.foo()
with (b) {
foo()
}
}
//variable as member extension
interface C
interface D {
val C.foo: Foo
fun test(c: C) {
c.foo()
with (c) {
foo()
}
}
}
fun test(d: D, c: C) {
with (d) {
c.foo()
with (c) {
foo()
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Foo {
operator fun invoke() {}
}
@@ -1,123 +0,0 @@
class Foo
//no variable
interface A {
operator fun Foo.invoke() {}
fun test(foo: Foo) {
foo()
}
}
//variable as member
interface B {
val foo: Foo
}
class C {
operator fun Foo.invoke() {}
fun test(b: B) {
b.foo()
with (b) {
foo()
}
}
}
fun test(c: C, b: B) {
with (c) {
b.foo()
with (b) {
foo()
}
}
}
//variable as extension,
interface D {
}
val D.foo: Foo
get() = Foo()
class E {
operator fun Foo.invoke() {}
fun test(d: D) {
d.foo()
with (d) {
foo()
}
}
}
fun test(e: E, d: D) {
with (e) {
d.foo()
with (d) {
foo()
}
}
}
//variable as member extension
interface F
interface G {
val F.foo: Foo
operator fun Foo.invoke()
fun test(f: F) {
f.foo()
with (f) {
foo()
}
}
}
fun test(g: G, f: F) {
with (g) {
f.foo()
with (f) {
foo()
}
}
}
//variable as member extension (2)
interface X
interface U {
val X.foo: Foo
}
interface V {
operator fun Foo.invoke() {}
fun U.test(x: X) {
x.foo()
with (x) {
foo()
}
}
}
fun test(u: U, v: V, x: X) {
with (v) {
with (u) {
x.foo()
with (x) {
foo()
}
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Foo
//no variable
@@ -1,7 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
class C {
fun f() {}
}
fun C.g(f: (String) -> Unit = { s -> f() }) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
class C {
@@ -1,35 +0,0 @@
//KT-3833 Invoke method not working inside companion object?
package m
class Either1 {
class Left() {
fun match(left: () -> Unit) {
left()
}
}
inner class Right() {
fun match(right: () -> Unit) {
right()
}
}
}
class X {
operator fun invoke() {
}
}
object Foo{
val v : X = X()
}
class C{
companion object {
fun f(){
Foo.v()
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-3833 Invoke method not working inside companion object?
package m
@@ -1,35 +0,0 @@
//KT-4321 invoke() on enum doesn't work
import DOMElementTestClasses.cls2
// use case 1
enum class DOMElementTestClasses {
cls1, cls2;
operator fun invoke() {}
}
// use case 2
interface EnumStyleClass {
operator fun invoke() {}
}
enum class TestClasses : EnumStyleClass {
cls
}
// example
fun main() {
// Kotlin: Expression 'cls1' of type 'DOMElementTestClasses' cannot be invoked as a function
DOMElementTestClasses.cls1()
// Kotlin: Expression 'cls2' of type 'DOMElementTestClasses' cannot be invoked as a function
cls2()
// Kotlin: Expression 'cls' of type 'TestClasses' cannot be invoked as a function
TestClasses.cls()
// All ok
val cls = DOMElementTestClasses.cls2
cls()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-4321 invoke() on enum doesn't work
import DOMElementTestClasses.cls2
@@ -1,9 +0,0 @@
interface A
fun foo(invoke: A.()->Unit, a: A) {
a.invoke()
}
fun bar(invoke: Any.()->Any, a: Any) {
a.invoke()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface A
fun foo(invoke: A.()->Unit, a: A) {