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:
@@ -354,7 +354,7 @@ public interface Errors {
|
||||
DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE);
|
||||
|
||||
DiagnosticFactory0<JetFunction> FUNCTION_DECLARATION_WITH_NO_NAME = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<PsiElement> FUNCTION_EXPRESSION_WITH_NAME = DiagnosticFactory0.create(WARNING);
|
||||
DiagnosticFactory0<PsiElement> FUNCTION_EXPRESSION_WITH_NAME = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<JetParameter> VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
|
||||
+1
-1
@@ -221,7 +221,7 @@ public class DefaultErrorMessages {
|
||||
|
||||
MAP.put(NON_MEMBER_FUNCTION_NO_BODY, "Function ''{0}'' must have a body", NAME);
|
||||
MAP.put(FUNCTION_DECLARATION_WITH_NO_NAME, "Function declaration must have a name");
|
||||
MAP.put(FUNCTION_EXPRESSION_WITH_NAME, "Function expressions with names are deprecated");
|
||||
MAP.put(FUNCTION_EXPRESSION_WITH_NAME, "Function expressions with names are prohibited");
|
||||
MAP.put(NON_FINAL_MEMBER_IN_FINAL_CLASS, "\"open\" has no effect in a final class");
|
||||
|
||||
MAP.put(FUNCTION_EXPRESSION_PARAMETER_WITH_DEFAULT_VALUE, "A function expression is not allowed to specify default values for its parameters");
|
||||
|
||||
-32
@@ -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"
|
||||
}
|
||||
-7
@@ -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 {
|
||||
|
||||
+1
-6
@@ -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
|
||||
}
|
||||
|
||||
Vendored
-16
@@ -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"
|
||||
}
|
||||
-6
@@ -4164,12 +4164,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionExpressionWithName.kt")
|
||||
public void testFunctionExpressionWithName() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/functions/functionExpression/functionExpressionWithName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("functionExpressionWithThisReference.kt")
|
||||
public void testFunctionExpressionWithThisReference() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/functions/functionExpression/functionExpressionWithThisReference.kt");
|
||||
|
||||
-6
@@ -3384,12 +3384,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("namedFunctionExpressionInProperty.kt")
|
||||
public void testNamedFunctionExpressionInProperty() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/enclosing/namedFunctionExpressionInProperty.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInLambda.kt")
|
||||
public void testObjectInLambda() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reflection/enclosing/objectInLambda.kt");
|
||||
|
||||
Reference in New Issue
Block a user