Replace deprecated lambda syntax in testData

It's done with similar constructions where possible trying to preserve
intended behavior.
Some usages are removed because they test exactly the feature that
we are going to drop soon.
This commit is contained in:
Denis Zharkov
2015-09-23 20:07:06 +03:00
parent 5f69789636
commit 73799e2c3c
73 changed files with 325 additions and 340 deletions
+8 -7
View File
@@ -1,16 +1,17 @@
// KT-306 Ambiguity when different this's have same-looking functions
fun test() {
<!UNUSED_FUNCTION_LITERAL!>{<!DEPRECATED_LAMBDA_SYNTAX!>Foo.()<!> ->
bar();
{<!DEPRECATED_LAMBDA_SYNTAX!>Barr.()<!> ->
(fun Foo.() {
bar()
(fun Barr.() {
this.bar()
bar()
}
}<!>
<!UNUSED_FUNCTION_LITERAL!>{<!DEPRECATED_LAMBDA_SYNTAX!>Barr.()<!> ->
})
})
(fun Barr.() {
this.bar()
bar()
}<!>
})
}
class Foo {
+5 -4
View File
@@ -2,18 +2,19 @@
package kt352
val f : (Any) -> Unit = { <!DEPRECATED_LAMBDA_SYNTAX!><!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> : Unit<!> -> } //type mismatch
val f : (Any) -> Unit = { <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!>-> } //type mismatch
fun foo() {
val <!UNUSED_VARIABLE!>f<!> : (Any) -> Unit = { <!DEPRECATED_LAMBDA_SYNTAX!><!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> : Unit<!> -> } //!!! no error
val <!UNUSED_VARIABLE!>f<!> : (Any) -> Unit = { <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!>-> } //!!! no error
}
class A() {
val f : (Any) -> Unit = { <!DEPRECATED_LAMBDA_SYNTAX!><!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> : Unit<!> -> } //type mismatch
val f : (Any) -> Unit = { <!EXPECTED_PARAMETERS_NUMBER_MISMATCH!><!>-> } //type mismatch
}
//more tests
val g : () -> Unit = { <!DEPRECATED_LAMBDA_SYNTAX!>(): <!EXPECTED_RETURN_TYPE_MISMATCH!>Int<!><!> -> 42 }
val g : () -> Unit = { <!UNUSED_EXPRESSION!>42<!> }
val gFunction : () -> Unit = <!TYPE_MISMATCH!>fun(): Int = 1<!>
val h : () -> Unit = { doSmth() }
@@ -3,6 +3,7 @@ package
package kt352 {
public val f: (kotlin.Any) -> kotlin.Unit
public val g: () -> kotlin.Unit
public val gFunction: () -> kotlin.Unit
public val h: () -> kotlin.Unit
public val testIt: (kotlin.Any) -> kotlin.Unit
public fun doSmth(): kotlin.Int