Change FUNCTION_EXPRESSION_WITH_NAME severity to ERROR

Also drop deprecation related parts and get rid of usages of this `feature` within testData
This commit is contained in:
Denis Zharkov
2015-09-24 15:23:22 +03:00
parent 1d90b2e1fe
commit 3f6cadf9b7
22 changed files with 8 additions and 227 deletions
@@ -1,32 +0,0 @@
val foo1 = fun Any.name(): String {
return "239" + this
}
val foo2 = fun Int.name(i : Int) : Int = this + i
fun <T> fooT1() = fun name(t : T) = t.toString()
annotation class A
fun box() : String {
if(10.foo1() != "23910") return "foo1 fail"
if(10.foo2(1) != 11) return "foo2 fail"
if(1.(fun Int.name() = this + 1)() != 2) return "test 3 failed";
if( (fun name() = 1)() != 1) return "test 4 failed";
if( (fun name(i: Int) = i)(1) != 1) return "test 5 failed";
if( 1.(fun Int.name(i: Int) = i + this)(1) != 2) return "test 6 failed";
if( (fooT1<String>()("mama")) != "mama") return "test 7 failed";
val a = @A fun Int.name() = this + 1 // name
if (1.a() != 2) return "test 8 failed"
val b = ( fun Int.name() = this + 1)
if (1.b() != 2) return "test 9 failed"
val c = (c@ fun Int.name() = this + 1)
if (1.c() != 2) return "test 10 failed"
val d = fun name(): Int { return@name 4}
if (d() != 4) return "test 11 failed"
return "OK"
}
@@ -1,17 +1,10 @@
fun simple() = fun (): Boolean { return true }
fun simpleNamed() = fun name(): Boolean { return true }
fun simpleNamed2() = fun name(): Boolean { return@name true }
fun withLabel() = l@ fun (): Boolean { return@l true }
fun withLabelNamed() = l@ fun name(): Boolean { return@l true }
fun box(): String {
if (!simple()()) return "Test simple failed"
if (!simpleNamed()()) return "Test simpleNamed failed"
if (!simpleNamed2()()) return "Test simpleNamed2 failed"
if (!withLabel()()) return "Test withLabel failed"
if (!withLabelNamed()()) return "Test withLabelNamed failed"
return "OK"
}
@@ -1,6 +1,6 @@
fun test1(): Int {
val inlineX = Inline(9)
return inlineX.calcExt(fun smth(z: Int) = z, 25)
return inlineX.calcExt(fun(z: Int) = z, 25)
}
fun test2(): Int {
@@ -9,15 +9,10 @@ fun test2(): String = (l@ fun (): String {
return "fail"
}) ()
fun test3(): String = (l@ fun bar(): String {
foo { return@bar "OK" }
return "fail"
}) ()
fun box(): String {
if (test() != "OK") return "fail 1: ${test()}"
if (test2() != "OK") return "fail 2: ${test2()}"
return test3()
return "OK"
}
@@ -21,7 +21,7 @@ fun test1(local: Int, nonLocal: String, doNonLocal: Boolean): String {
fun test2(local: Int, nonLocal: String, doNonLocal: Boolean): String {
val localResult = doCall(
fun xxx(): Int {
xxx@ fun(): Int {
if (doNonLocal) {
return@test2 nonLocal
}
@@ -39,7 +39,7 @@ fun test2(local: Int, nonLocal: String, doNonLocal: Boolean): String {
fun test3(local: Int, nonLocal: String, doNonLocal: Boolean): String {
val localResult = doCall(
yy@ fun xxx(): Int {
yy@ fun(): Int {
if (doNonLocal) {
return@test3 nonLocal
}
@@ -1,16 +0,0 @@
val property = fun name() {}
fun box(): String {
val javaClass = property.javaClass
val enclosingMethod = javaClass.getEnclosingMethod()
if (enclosingMethod != null) return "method: $enclosingMethod"
val enclosingClass = javaClass.getEnclosingClass()!!.getName()
if (enclosingClass != "NamedFunctionExpressionInPropertyKt") return "enclosing class: $enclosingClass"
val declaringClass = javaClass.getDeclaringClass()
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
return "OK"
}