From e97e82d1193faac5674a3e12e83becdbfd2ac5c9 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 8 Dec 2015 16:31:01 +0100 Subject: [PATCH] use terms "lambda expression" and "anonymous function" instead of "function literal" and "function expression" --- .../cfg/KotlinFlowInformationProvider.java | 2 +- .../jetbrains/kotlin/diagnostics/Errors.java | 17 +++++++++-------- .../rendering/DefaultErrorMessages.java | 14 +++++++------- .../kotlin/psi/KtFunctionNotStubbed.java | 2 +- .../kotlin/resolve/AnnotationChecker.kt | 10 +++++----- .../calls/ValueArgumentsToParametersMapper.java | 2 +- .../BasicExpressionTypingVisitor.java | 4 ++-- .../types/expressions/FunctionsTypingVisitor.kt | 4 ++-- .../tests/annotations/options/functions.kt | 4 ++-- .../checkArguments/kt1897_diagnostic_part.kt | 2 +- .../tests/controlFlowAnalysis/kt1977.kt | 2 +- .../lambdasInExclExclAndElvis.kt | 10 +++++----- .../functionAsExpression/NameDeprecation.kt | 6 +++--- .../tests/functionAsExpression/Parameters.kt | 10 +++++----- .../tests/functionLiterals/unusedLiteral.kt | 4 ++-- .../unusedLiteralInsideUnitLiteral.kt | 2 +- .../pseudocodeTraverseNextInstructions.kt | 2 +- .../testData/diagnostics/tests/labels/kt361.kt | 2 +- .../diagnostics/tests/regressions/kt402.kt | 2 +- .../ShadowParameterInNestedBlockInFor.kt | 2 +- .../shadowing/ShadowVariableInNestedBlock.kt | 2 +- .../shadowing/ShadowVariableInNestedClosure.kt | 2 +- .../ShadowVariableInNestedClosureParam.kt | 2 +- .../tests/smartCasts/loops/doWhileLiteral.kt | 2 +- .../descriptors/annotations/KotlinTarget.kt | 6 +++--- .../jvm/internal/KFunctionFromReferenceImpl.kt | 2 +- .../kotlin/idea/KotlinBundle.properties | 5 ++--- .../description.html | 2 +- .../description.html | 2 +- .../ChangeFunctionLiteralReturnTypeFix.java | 4 ++-- .../ChangeFunctionLiteralSignatureFix.kt | 2 +- .../kotlin/idea/quickfix/QuickFixRegistrar.kt | 2 +- .../RemoveNameFromFunctionExpressionFix.kt | 2 +- idea/testData/checker/Unused.kt | 2 +- .../changeFunctionLiteralParameters1.kt | 2 +- .../changeFunctionLiteralParameters1.kt.after | 2 +- .../changeFunctionLiteralParameters2.kt | 2 +- .../changeFunctionLiteralParameters2.kt.after | 2 +- .../fixExtensionLambdaSignature.kt | 2 +- .../fixExtensionLambdaSignature.kt.after | 2 +- .../matchFunctionLiteralWithSAMType.after.kt | 2 +- ...tchFunctionLiteralWithSAMType.before.Main.kt | 2 +- .../removeNameFromFunctionExpression/basic.kt | 2 +- .../basic.kt.after | 2 +- 44 files changed, 80 insertions(+), 80 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/KotlinFlowInformationProvider.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/KotlinFlowInformationProvider.java index 4b2f89b279f..4fbcb9310de 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/KotlinFlowInformationProvider.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/KotlinFlowInformationProvider.java @@ -662,7 +662,7 @@ public class KotlinFlowInformationProvider { VariableContext ctxt = new VariableContext(instruction, reportedDiagnosticMap); report( element instanceof KtFunctionLiteralExpression - ? Errors.UNUSED_FUNCTION_LITERAL.on((KtFunctionLiteralExpression) element) + ? Errors.UNUSED_LAMBDA_EXPRESSION.on((KtFunctionLiteralExpression) element) : Errors.UNUSED_EXPRESSION.on(element), ctxt ); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 07b1afb2451..dfd065f3c7f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -138,7 +138,7 @@ public interface Errors { DiagnosticFactory1 WRONG_ANNOTATION_TARGET = DiagnosticFactory1.create(ERROR); DiagnosticFactory2 WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET = DiagnosticFactory2.create(ERROR); DiagnosticFactory0 REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 NON_SOURCE_ANNOTATION_ON_INLINED_FUNCTION_LITERAL = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 NON_SOURCE_ANNOTATION_ON_INLINED_LAMBDA_EXPRESSION = DiagnosticFactory0.create(ERROR); // Annotations @@ -395,13 +395,14 @@ public interface Errors { DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory0 FUNCTION_DECLARATION_WITH_NO_NAME = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 FUNCTION_EXPRESSION_WITH_NAME = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 ANONYMOUS_FUNCTION_WITH_NAME = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 NO_TAIL_CALLS_FOUND = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE); - DiagnosticFactory0 FUNCTION_EXPRESSION_PARAMETER_WITH_DEFAULT_VALUE = DiagnosticFactory0.create(ERROR, PARAMETER_DEFAULT_VALUE); + DiagnosticFactory0 + ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE = DiagnosticFactory0.create(ERROR, PARAMETER_DEFAULT_VALUE); DiagnosticFactory0 USELESS_VARARG_ON_PARAMETER = DiagnosticFactory0.create(WARNING); @@ -456,7 +457,7 @@ public interface Errors { DiagnosticFactory0 NON_VARARG_SPREAD = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 SPREAD_OF_NULLABLE = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 MANY_FUNCTION_LITERAL_ARGUMENTS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 MANY_LAMBDA_EXPRESSION_ARGUMENTS = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 TOO_MANY_ARGUMENTS = DiagnosticFactory1.create(ERROR); @@ -611,7 +612,7 @@ public interface Errors { DiagnosticFactory2 UNUSED_VALUE = DiagnosticFactory2.create(WARNING, PositioningStrategies.UNUSED_VALUE); DiagnosticFactory1 UNUSED_CHANGED_VALUE = DiagnosticFactory1.create(WARNING); DiagnosticFactory0 UNUSED_EXPRESSION = DiagnosticFactory0.create(WARNING); - DiagnosticFactory0 UNUSED_FUNCTION_LITERAL = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 UNUSED_LAMBDA_EXPRESSION = DiagnosticFactory0.create(WARNING); DiagnosticFactory1 VAL_REASSIGNMENT = DiagnosticFactory1.create(ERROR); DiagnosticFactory1 SETTER_PROJECTED_OUT = DiagnosticFactory1.create(ERROR); @@ -633,10 +634,10 @@ public interface Errors { DiagnosticFactory1 UNNECESSARY_SAFE_CALL = DiagnosticFactory1.create(WARNING); DiagnosticFactory0 UNEXPECTED_SAFE_CALL = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 UNNECESSARY_NOT_NULL_ASSERTION = DiagnosticFactory1.create(WARNING); - DiagnosticFactory0 NOT_NULL_ASSERTION_ON_FUNCTION_LITERAL = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION = DiagnosticFactory0.create(WARNING); DiagnosticFactory1 USELESS_ELVIS = DiagnosticFactory1.create(WARNING, PositioningStrategies.USELESS_ELVIS); - DiagnosticFactory0 USELESS_ELVIS_ON_FUNCTION_LITERAL = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 USELESS_ELVIS_ON_LAMBDA_EXPRESSION = DiagnosticFactory0.create(WARNING); // Compile-time values @@ -758,7 +759,7 @@ public interface Errors { INVISIBLE_MEMBER, INVISIBLE_MEMBER_FROM_INLINE, INVISIBLE_REFERENCE, INVISIBLE_SETTER); ImmutableSet> UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of( UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE, VARIABLE_WITH_REDUNDANT_INITIALIZER, - UNUSED_FUNCTION_LITERAL, USELESS_CAST, UNUSED_VALUE, USELESS_ELVIS); + UNUSED_LAMBDA_EXPRESSION, USELESS_CAST, UNUSED_VALUE, USELESS_ELVIS); ImmutableSet> TYPE_INFERENCE_ERRORS = ImmutableSet.of( TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS, TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 2f75f6aa1ae..285870dc9d1 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -137,7 +137,7 @@ public class DefaultErrorMessages { MAP.put(WRONG_ANNOTATION_TARGET, "This annotation is not applicable to target ''{0}''", TO_STRING); MAP.put(WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET, "This annotation is not applicable to target ''{0}'' and use site target ''@{1}''", TO_STRING, TO_STRING); MAP.put(REPEATED_ANNOTATION, "This annotation is not repeatable"); - MAP.put(NON_SOURCE_ANNOTATION_ON_INLINED_FUNCTION_LITERAL, "Function literal here is an inlined argument so this annotation cannot be stored anywhere"); + MAP.put(NON_SOURCE_ANNOTATION_ON_INLINED_LAMBDA_EXPRESSION, "The lambda expression here is an inlined argument so this annotation cannot be stored anywhere"); MAP.put(INAPPLICABLE_TARGET_ON_PROPERTY, "''@{0}'' annotations could be applied only to property declarations", TO_STRING); MAP.put(INAPPLICABLE_FIELD_TARGET_NO_BACKING_FIELD, "Property has neither a backing field nor a delegate"); @@ -187,7 +187,7 @@ public class DefaultErrorMessages { MAP.put(NON_VARARG_SPREAD, "The spread operator (*foo) may only be applied in a vararg position"); MAP.put(SPREAD_OF_NULLABLE, "The spread operator (*foo) may not be applied to an argument of nullable type"); - MAP.put(MANY_FUNCTION_LITERAL_ARGUMENTS, "Only one function literal is allowed outside a parenthesized argument list"); + MAP.put(MANY_LAMBDA_EXPRESSION_ARGUMENTS, "Only one lambda expression is allowed outside a parenthesized argument list"); MAP.put(PROPERTY_WITH_NO_TYPE_NO_INITIALIZER, "This property must either have a type annotation, be initialized or be delegated"); MAP.put(VARIABLE_WITH_NO_TYPE_NO_INITIALIZER, "This variable must either have a type annotation or be initialized"); @@ -228,10 +228,10 @@ 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 prohibited"); + MAP.put(ANONYMOUS_FUNCTION_WITH_NAME, "Anonymous functions 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"); + MAP.put(ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE, "An anonymous function is not allowed to specify default values for its parameters"); MAP.put(USELESS_VARARG_ON_PARAMETER, "Vararg on this parameter is useless"); MAP.put(PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT, "Projections are not allowed on type arguments of functions and properties"); @@ -256,7 +256,7 @@ public class DefaultErrorMessages { MAP.put(UNUSED_VALUE, "The value ''{0}'' assigned to ''{1}'' is never used", ELEMENT_TEXT, FQ_NAMES_IN_TYPES); MAP.put(UNUSED_CHANGED_VALUE, "The value changed at ''{0}'' is never used", ELEMENT_TEXT); MAP.put(UNUSED_EXPRESSION, "The expression is unused"); - MAP.put(UNUSED_FUNCTION_LITERAL, "The function literal is unused. If you mean block, you can use 'run { ... }'"); + MAP.put(UNUSED_LAMBDA_EXPRESSION, "The lambda expression is unused. If you mean a block, you can use 'run { ... }'"); MAP.put(VAL_REASSIGNMENT, "Val cannot be reassigned", NAME); MAP.put(SETTER_PROJECTED_OUT, "Setter for ''{0}'' is removed by type projection", NAME); @@ -399,7 +399,7 @@ public class DefaultErrorMessages { MAP.put(REPEATED_BOUND, "Type parameter already has this bound"); MAP.put(DYNAMIC_UPPER_BOUND, "Dynamic type can not be used as an upper bound"); MAP.put(USELESS_ELVIS, "Elvis operator (?:) always returns the left operand of non-nullable type {0}", RENDER_TYPE); - MAP.put(USELESS_ELVIS_ON_FUNCTION_LITERAL, "Left operand of elvis operator (?:) is function literal"); + MAP.put(USELESS_ELVIS_ON_LAMBDA_EXPRESSION, "Left operand of elvis operator (?:) is a lambda expression"); MAP.put(CONFLICTING_UPPER_BOUNDS, "Upper bounds of {0} have empty intersection", NAME); MAP.put(TOO_MANY_ARGUMENTS, "Too many arguments for {0}", FQ_NAMES_IN_TYPES); @@ -475,7 +475,7 @@ public class DefaultErrorMessages { MAP.put(UNNECESSARY_SAFE_CALL, "Unnecessary safe call on a non-null receiver of type {0}", RENDER_TYPE); MAP.put(UNEXPECTED_SAFE_CALL, "Safe-call is not allowed here"); MAP.put(UNNECESSARY_NOT_NULL_ASSERTION, "Unnecessary non-null assertion (!!) on a non-null receiver of type {0}", RENDER_TYPE); - MAP.put(NOT_NULL_ASSERTION_ON_FUNCTION_LITERAL, "Non-null assertion (!!) is called on function literal"); + MAP.put(NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION, "Non-null assertion (!!) is called on a lambda expression"); MAP.put(NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER, "{0} does not refer to a type parameter of {1}", new Renderer() { @NotNull @Override diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java index 88f1654a683..bbff9f136de 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtFunctionNotStubbed.java @@ -71,7 +71,7 @@ public abstract class KtFunctionNotStubbed extends KtTypeParameterListOwnerNotSt @Override public KtTypeReference setTypeReference(@Nullable KtTypeReference typeRef) { if (typeRef == null) return null; - throw new IllegalStateException("Function literals can't have type reference"); + throw new IllegalStateException("Lambda expressions can't have type reference"); } @Nullable diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt index 4b32e10373d..bc8dd9a118a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt @@ -114,7 +114,7 @@ public class AnnotationChecker(private val additionalCheckers: Iterable if (annotated.projectionKind == KtProjectionKind.STAR) TargetLists.T_STAR_PROJECTION else TargetLists.T_TYPE_PROJECTION is KtAnonymousInitializer -> TargetLists.T_INITIALIZER - is KtMultiDeclaration -> TargetLists.T_MULTI_DECLARATION + is KtMultiDeclaration -> TargetLists.T_DESTRUCTURING_DECLARATION is KtFunctionLiteralExpression -> TargetLists.T_FUNCTION_LITERAL is KtObjectLiteralExpression -> TargetLists.T_OBJECT_LITERAL is KtExpression -> TargetLists.T_EXPRESSION @@ -218,7 +218,7 @@ public class AnnotationChecker(private val additionalCheckers: Iterable@FunAnn { arg } - fast2(1, @FunAnn { arg }) + fast @FunAnn { arg } + fast2(1, @FunAnn { arg }) // Source annotation, ok fast @SourceAnn { arg } fast2(1, @SourceAnn { arg }) diff --git a/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt b/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt index 62081dabbde..5294be69620 100644 --- a/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt +++ b/compiler/testData/diagnostics/tests/checkArguments/kt1897_diagnostic_part.kt @@ -24,5 +24,5 @@ fun test() { foo("", 1) {} - foo("", 1) {} {} + foo("", 1) {} {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1977.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1977.kt index 3f38218b295..5c02e5c36f4 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1977.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1977.kt @@ -29,7 +29,7 @@ fun test2(s : String) : Int? { Integer.parseInt(s) 22 } finally { - { + { x : Int -> x } } diff --git a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt b/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt index 4f95279d5ea..fbf5455390e 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/lambdasInExclExclAndElvis.kt @@ -3,13 +3,13 @@ fun use(a: Any?) = a fun test() { - { }!! - use({ }!!); + { }!! + use({ }!!); // KT-KT-9070 - { } ?: 1 - use({ 2 } ?: 1); + { } ?: 1 + use({ 2 } ?: 1); - 1 ?: { } + 1 ?: { } use(1 ?: { }) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.kt b/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.kt index 99f47c46497..cdabd0602df 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.kt @@ -3,9 +3,9 @@ fun foo() { class A fun bar() {} - (fun bar() {}) + (fun bar() {}) fun A.foo() {} - (fun A.foo() {}) + (fun A.foo() {}) - run(fun foo() {}) + run(fun foo() {}) } diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/Parameters.kt b/compiler/testData/diagnostics/tests/functionAsExpression/Parameters.kt index 8b42597b6d2..ebfac6efbcc 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/Parameters.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/Parameters.kt @@ -1,18 +1,18 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -val bar = fun(p: Int = 3) {} +val bar = fun(p: Int = 3) {} val bas = fun(vararg p: Int) {} -fun gar() = fun(p: Int = 3) {} +fun gar() = fun(p: Int = 3) {} fun gas() = fun(vararg p: Int) {} fun outer(b: Any?) { - val bar = fun(p: Int = 3) {} + val bar = fun(p: Int = 3) {} val bas = fun(vararg p: Int) {} - fun gar() = fun(p: Int = 3) {} + fun gar() = fun(p: Int = 3) {} fun gas() = fun(vararg p: Int) {} - outer(fun(p: Int = 3) {}) + outer(fun(p: Int = 3) {}) outer(fun(vararg p: Int) {}) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt index ea9148e251c..05c2d1eda9d 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt @@ -1,12 +1,12 @@ fun unusedLiteral(){ - { -> + { -> val i = 1 } } fun unusedLiteralInDoWhile(){ - do{ -> + do{ -> val i = 1 } while(false) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt index 22ac992b5fe..0d445a178aa 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/unusedLiteralInsideUnitLiteral.kt @@ -1,6 +1,6 @@ fun main(args: Array) { "".run { - {} + {} } } diff --git a/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt b/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt index d83399b474a..94fb4030208 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/pseudocodeTraverseNextInstructions.kt @@ -2,7 +2,7 @@ package b fun foo() { for (i in collection) { - { + { break } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/labels/kt361.kt b/compiler/testData/diagnostics/tests/labels/kt361.kt index 621d551b151..44930c071d0 100644 --- a/compiler/testData/diagnostics/tests/labels/kt361.kt +++ b/compiler/testData/diagnostics/tests/labels/kt361.kt @@ -1,5 +1,5 @@ fun nonlocals(b : Boolean) { - a@{ + a@{ fun foo() { if (b) { return@a 1 // The label must be resolved, but an error should be reported for a non-local return diff --git a/compiler/testData/diagnostics/tests/regressions/kt402.kt b/compiler/testData/diagnostics/tests/regressions/kt402.kt index 291691d51a4..277117c35d7 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt402.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt402.kt @@ -1,7 +1,7 @@ package kt402 fun getTypeChecker() : (Any)->Boolean { - { a : Any -> a is T } // reports unsupported + { a : Any -> a is T } // reports unsupported } fun f() : (Any) -> Boolean { return { a : Any -> a is String } diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt index 8d11904199a..3ed0cdd3541 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowParameterInNestedBlockInFor.kt @@ -1,6 +1,6 @@ fun f(i: Int) { for (j in 1..100) { - { + { var i = 12 } } diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt index 815357015d2..dadd00da351 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedBlock.kt @@ -1,6 +1,6 @@ fun ff(): Int { var i = 1 - { + { val i = 2 } return i diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt index 3d8574972f5..c525b548841 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosure.kt @@ -1,5 +1,5 @@ fun f(): Int { var i = 17 - { var i = 18 } + { var i = 18 } return i } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt index 0b2dcdbbeea..f015847d3e6 100644 --- a/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt +++ b/compiler/testData/diagnostics/tests/shadowing/ShadowVariableInNestedClosureParam.kt @@ -1,5 +1,5 @@ fun ff(): Int { var i = 1 - { i: Int -> i } + { i: Int -> i } return i } diff --git a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt index 829b9ba539e..cdfdca72128 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/loops/doWhileLiteral.kt @@ -2,7 +2,7 @@ fun x(): Boolean { return true } public fun foo(p: String?): Int { // Exotic variant with unused literal - do { -> + do { -> p!!.length } while (!x()) // Literal is not called so p.length is unsafe diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt index fd696fe1545..9f5d7897949 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt @@ -61,9 +61,9 @@ public enum class KotlinTarget(val description: String, val isDefault: Boolean = TOP_LEVEL_PROPERTY("top level property", false), INITIALIZER("initializer", false), - MULTI_DECLARATION("multi declaration", false), - FUNCTION_LITERAL("function literal", false), - FUNCTION_EXPRESSION("function expression", false), + DESTRUCTURING_DECLARATION("destructuring declaration", false), + LAMBDA_EXPRESSION("lambda expression", false), + ANONYMOUS_FUNCTION("anonymous function", false), OBJECT_LITERAL("object literal", false) ; diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt index edca11c2dab..3a497422c9e 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt @@ -76,6 +76,6 @@ internal object EmptyContainerForLocal : KDeclarationContainerImpl() { override fun getFunctions(name: Name): Collection = fail() - private fun fail() = throw KotlinReflectionInternalError("Introspecting local functions, lambdas and function expressions " + + private fun fail() = throw KotlinReflectionInternalError("Introspecting local functions, lambdas and anonymous functions " + "is not yet fully supported in Kotlin reflection") } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties index adebd0582ec..a8f1ea889d3 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/KotlinBundle.properties @@ -48,7 +48,6 @@ add.semicolon.after.invocation=Add semicolon after invocation of ''{0}'' add.semicolon.family=Add Semicolon change.function.return.type=Change ''{0}'' function return type to ''{1}'' change.no.name.function.return.type=Change function return type to ''{0}'' -change.function.literal.return.type=Change function literal return type to ''{0}'' remove.function.return.type=Remove explicitly specified return type in ''{0}'' function remove.no.name.function.return.type=Remove explicitly specified function return type change.element.type=Change ''{0}'' type to ''{1}'' @@ -106,7 +105,7 @@ change.visibility.modifier=Change visibility modifier options.kotlin.attribute.descriptor.builtin.annotation=Built-in annotation options.kotlin.attribute.descriptor.string.escape=Escape in string and template braces -options.kotlin.attribute.descriptor.closure.braces=Function literal braces and arrow +options.kotlin.attribute.descriptor.closure.braces=Lambda expression braces and arrow options.kotlin.attribute.descriptor.safe.access=Safe access dot options.kotlin.attribute.descriptor.arrow=Arrow options.kotlin.attribute.descriptor.kdoc.comment=KDoc comment @@ -124,7 +123,7 @@ options.kotlin.attribute.descriptor.property.with.backing=Property with backing options.kotlin.attribute.descriptor.field=Backing field variable options.kotlin.attribute.descriptor.extension.property=Extension property options.kotlin.attribute.descriptor.dynamic.property=Dynamic property -options.kotlin.attribute.descriptor.it=Function literal default parameter +options.kotlin.attribute.descriptor.it=Lambda expression default parameter options.kotlin.attribute.descriptor.fun=Function declaration options.kotlin.attribute.descriptor.fun.call=Function call options.kotlin.attribute.descriptor.dynamic.fun.call=Dynamic function call diff --git a/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/description.html b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/description.html index becf4aaf250..aaf025b64a8 100644 --- a/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/description.html +++ b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/description.html @@ -1,5 +1,5 @@ - This intention replaces the explicit parameter of a single-parameter function literal with the implicit 'it' parameter. + This intention replaces the explicit parameter of a single-parameter lambda expression with the implicit 'it' parameter. diff --git a/idea/resources/intentionDescriptions/ReplaceItWithExplicitFunctionLiteralParamIntention/description.html b/idea/resources/intentionDescriptions/ReplaceItWithExplicitFunctionLiteralParamIntention/description.html index 1962303ff2b..8f24346c080 100644 --- a/idea/resources/intentionDescriptions/ReplaceItWithExplicitFunctionLiteralParamIntention/description.html +++ b/idea/resources/intentionDescriptions/ReplaceItWithExplicitFunctionLiteralParamIntention/description.html @@ -1,5 +1,5 @@ - This intention replaces the implicit 'it' parameter in a function literal with an explicitly named parameter. + This intention replaces the implicit 'it' parameter in a lambda expression with an explicitly named parameter. diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.java b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.java index 128a465b962..c60a423602c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.java +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.java @@ -116,8 +116,8 @@ public class ChangeFunctionLiteralReturnTypeFix extends KotlinQuickFixAction ) : ChangeFunctionSignatureFix(functionLiteral, functionDescriptor) { - override fun getText() = "Change the signature of function literal" + override fun getText() = "Change the signature of lambda expression" override fun invoke(project: Project, editor: Editor?, file: KtFile) { runChangeSignature( diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index f6783e7738f..e495a1a2544 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -312,7 +312,7 @@ public class QuickFixRegistrar : QuickFixContributor { MISSING_CONSTRUCTOR_KEYWORD.registerFactory(MissingConstructorKeywordFix, MissingConstructorKeywordFix.createWholeProjectFixFactory()) - FUNCTION_EXPRESSION_WITH_NAME.registerFactory(RemoveNameFromFunctionExpressionFix) + ANONYMOUS_FUNCTION_WITH_NAME.registerFactory(RemoveNameFromFunctionExpressionFix) UNRESOLVED_REFERENCE.registerFactory(ReplaceObsoleteLabelSyntaxFix, ReplaceObsoleteLabelSyntaxFix.createWholeProjectFixFactory()) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveNameFromFunctionExpressionFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveNameFromFunctionExpressionFix.kt index 8809d69dad6..cc510459439 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveNameFromFunctionExpressionFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveNameFromFunctionExpressionFix.kt @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType import org.jetbrains.kotlin.resolve.BindingContext public class RemoveNameFromFunctionExpressionFix(element: KtNamedFunction) : KotlinQuickFixAction(element), CleanupFix { - override fun getText(): String = "Remove identifier from function expression" + override fun getText(): String = "Remove identifier from anonymous function" override fun getFamilyName(): String = getText() override fun invoke(project: Project, editor: Editor?, file: KtFile) = removeNameFromFunction(element) diff --git a/idea/testData/checker/Unused.kt b/idea/testData/checker/Unused.kt index 593af6a6eb0..33b3ad70ba3 100644 --- a/idea/testData/checker/Unused.kt +++ b/idea/testData/checker/Unused.kt @@ -2,7 +2,7 @@ fun test(unusedParamas String // USELESS_CAST - // UNUSED_FUNCTION_LITERAL + // UNUSED_LAMBDA_EXPRESSION { test(0) } diff --git a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt index ca3712073d9..b64f06b529f 100644 --- a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt +++ b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" // DISABLE-ERRORS fun f(x: Int, y: Int, z : () -> Int) { diff --git a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt.after b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt.after index 190a2110f31..8f1ee203383 100644 --- a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt.after +++ b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters1.kt.after @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" // DISABLE-ERRORS fun f(x: Int, y: Int, z : () -> Int) { diff --git a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt index 2a49b3dbefc..7d2506dad57 100644 --- a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt +++ b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" // DISABLE-ERRORS fun f(x: Int, y: Int, z : (Int, Int?, Any) -> Int) { diff --git a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt.after b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt.after index 8c0569b0552..8e55b3a161a 100644 --- a/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt.after +++ b/idea/testData/quickfix/changeSignature/changeFunctionLiteralParameters2.kt.after @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" // DISABLE-ERRORS fun f(x: Int, y: Int, z : (Int, Int?, Any) -> Int) { diff --git a/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt b/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt index 6914871dee3..539df606f60 100644 --- a/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt +++ b/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" fun foo(f: Int.(Int, Int) -> Int) { diff --git a/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt.after b/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt.after index a3a82db4be1..ce9a7dd847e 100644 --- a/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt.after +++ b/idea/testData/quickfix/changeSignature/fixExtensionLambdaSignature.kt.after @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" fun foo(f: Int.(Int, Int) -> Int) { diff --git a/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.after.kt b/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.after.kt index 4b6fb3e6378..aec2b5220c9 100644 --- a/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.after.kt +++ b/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.after.kt @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" // DISABLE-ERRORS fun main(args: Array) { diff --git a/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.before.Main.kt b/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.before.Main.kt index e9da67b45a4..b35581fa134 100644 --- a/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.before.Main.kt +++ b/idea/testData/quickfix/changeSignature/matchFunctionLiteralWithSAMType.before.Main.kt @@ -1,4 +1,4 @@ -// "Change the signature of function literal" "true" +// "Change the signature of lambda expression" "true" // DISABLE-ERRORS fun main(args: Array) { diff --git a/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt b/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt index 3d966df7421..afa90611143 100644 --- a/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt +++ b/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt @@ -1,4 +1,4 @@ -// "Remove identifier from function expression" "true" +// "Remove identifier from anonymous function" "true" fun foo() { (fun bar() { diff --git a/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt.after b/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt.after index d1054076742..f1dc70f54fd 100644 --- a/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt.after +++ b/idea/testData/quickfix/migration/removeNameFromFunctionExpression/basic.kt.after @@ -1,4 +1,4 @@ -// "Remove identifier from function expression" "true" +// "Remove identifier from anonymous function" "true" fun foo() { (bar@ fun() {