Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed
This commit is contained in:
-53
@@ -1,53 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
class A
|
||||
|
||||
operator fun A.component1() = 1
|
||||
operator fun A.component2() = ""
|
||||
|
||||
class B
|
||||
|
||||
class D {
|
||||
operator fun A.component1() = 1.0
|
||||
operator fun A.component2() = ' '
|
||||
|
||||
operator fun B.component1() = 1.0
|
||||
operator fun B.component2() = ' '
|
||||
}
|
||||
|
||||
fun foo(block: (A) -> Unit) { }
|
||||
fun foobaz(block: D.(B) -> Unit) { }
|
||||
fun foobar(block: D.(A) -> Unit) { }
|
||||
|
||||
fun bar() {
|
||||
foo { (a, b) ->
|
||||
a checkType { _<Int>() }
|
||||
b checkType { _<String>() }
|
||||
}
|
||||
|
||||
foo { (a: Int, b: String) ->
|
||||
a checkType { _<Int>() }
|
||||
b checkType { _<String>() }
|
||||
}
|
||||
|
||||
// From KEEP: Component-functions are resolved in the same scope as the first statement of the lambda
|
||||
foobaz { (a, b) ->
|
||||
a checkType { _<Double>() }
|
||||
b checkType { _<Char>() }
|
||||
}
|
||||
|
||||
// From KEEP: Component-functions are resolved in the same scope as the first statement of the lambda
|
||||
// So `component1`/`component2` for lambda parameters were resolved to member extensions
|
||||
foobar { (a, b) ->
|
||||
a checkType { _<Double>() }
|
||||
b checkType { _<Char>() }
|
||||
}
|
||||
|
||||
// the following code fails with exception, see KT-13873
|
||||
// foobarbaz {
|
||||
// component1: B.() -> Int,
|
||||
// component2: B.() -> String,
|
||||
// (a, b): B ->
|
||||
//
|
||||
// }
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
class A
|
||||
|
||||
Vendored
-25
@@ -1,25 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
data class A(val x: Int, val y: String)
|
||||
|
||||
fun foo(block: (A) -> Unit) { }
|
||||
|
||||
fun bar(a: Double) {
|
||||
val b = 1.toShort()
|
||||
// Do not report NAME_SHADOWING on lambda destructured parameter, the same way as for common parameters
|
||||
foo { (a, b) ->
|
||||
a checkType { _<Int>() }
|
||||
b checkType { _<String>() }
|
||||
}
|
||||
|
||||
foo { (c, d) ->
|
||||
c checkType { _<Int>() }
|
||||
d checkType { _<String>() }
|
||||
|
||||
foo { (a, c) ->
|
||||
a checkType { _<Int>() }
|
||||
c checkType { _<String>() }
|
||||
d checkType { _<String>() }
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
data class A(val x: Int, val y: String)
|
||||
|
||||
Reference in New Issue
Block a user