use "destructuring declarations" term instead of "multi-declarations"

This commit is contained in:
Dmitry Jemerov
2015-11-16 16:03:46 +01:00
parent ba47bfa752
commit bf35099e0c
14 changed files with 47 additions and 47 deletions
@@ -507,9 +507,9 @@ public interface Errors {
DiagnosticFactory0<KtExpression> CLASS_LITERAL_LHS_NOT_A_CLASS = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> ARRAY_CLASS_LITERAL_REQUIRES_ARGUMENT = DiagnosticFactory0.create(ERROR);
// Multi-declarations
// Destructuring-declarations
DiagnosticFactory0<KtMultiDeclaration> INITIALIZER_REQUIRED_FOR_MULTIDECLARATION = DiagnosticFactory0.create(ERROR, DEFAULT);
DiagnosticFactory0<KtMultiDeclaration> INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION = DiagnosticFactory0.create(ERROR, DEFAULT);
DiagnosticFactory2<KtExpression, Name, KotlinType> COMPONENT_FUNCTION_MISSING = DiagnosticFactory2.create(ERROR, DEFAULT);
DiagnosticFactory2<KtExpression, Name, Collection<? extends ResolvedCall<?>>> COMPONENT_FUNCTION_AMBIGUITY = DiagnosticFactory2.create(ERROR, DEFAULT);
DiagnosticFactory3<KtExpression, Name, KotlinType, KotlinType> COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH = DiagnosticFactory3.create(ERROR, DEFAULT);
@@ -189,8 +189,8 @@ public class DefaultErrorMessages {
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");
MAP.put(INITIALIZER_REQUIRED_FOR_MULTIDECLARATION, "Initializer required for multi-declaration");
MAP.put(COMPONENT_FUNCTION_MISSING, "Multi-declaration initializer of type {1} must have a ''{0}()'' function", TO_STRING, RENDER_TYPE);
MAP.put(INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION, "Initializer required for destructuring declaration");
MAP.put(COMPONENT_FUNCTION_MISSING, "Destructuring declaration initializer of type {1} must have a ''{0}()'' function", TO_STRING, RENDER_TYPE);
MAP.put(COMPONENT_FUNCTION_AMBIGUITY, "Function ''{0}()'' is ambiguous for this expression: {1}", TO_STRING, AMBIGUOUS_CALLS);
MAP.put(COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH, "''{0}()'' function returns ''{1}'', but ''{2}'' is expected",
TO_STRING, RENDER_TYPE, RENDER_TYPE);
@@ -1226,12 +1226,12 @@ public class KotlinParsing extends AbstractKotlinParsing {
boolean multiDeclaration = at(LPAR);
errorIf(receiver, multiDeclaration && receiverTypeDeclared, "Receiver type is not allowed on a multi-declaration");
errorIf(receiver, multiDeclaration && receiverTypeDeclared, "Receiver type is not allowed on a destructuring declaration");
if (multiDeclaration) {
PsiBuilder.Marker multiDecl = mark();
parseMultiDeclarationName(propertyNameFollow);
errorIf(multiDecl, !local, "Multi-declarations are only allowed for local variables/values");
errorIf(multiDecl, !local, "Destructuring declarations are only allowed for local variables/values");
}
else {
parseFunctionOrPropertyName(receiverTypeDeclared, "property", propertyNameFollow, /*nameRequired = */ false);
@@ -1243,7 +1243,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
PsiBuilder.Marker type = mark();
advance(); // COLON
parseTypeRef();
errorIf(type, multiDeclaration, "Type annotations are not allowed on multi-declarations");
errorIf(type, multiDeclaration, "Type annotations are not allowed on destructuring declarations");
}
parseTypeConstraintsGuarded(typeParametersDeclared);
@@ -166,7 +166,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
KtExpression initializer = multiDeclaration.getInitializer();
if (initializer == null) {
context.trace.report(INITIALIZER_REQUIRED_FOR_MULTIDECLARATION.on(multiDeclaration));
context.trace.report(INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION.on(multiDeclaration));
return TypeInfoFactoryKt.noTypeInfo(context);
}
ExpressionReceiver expressionReceiver = ExpressionTypingUtils.getExpressionReceiver(
+14 -14
View File
@@ -411,7 +411,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Receiver type is not allowed on a multi-declaration
PsiErrorElement:Receiver type is not allowed on a destructuring declaration
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
@@ -434,7 +434,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
PsiElement(RPAR)(')')
PsiErrorElement:Type annotations are not allowed on multi-declarations
PsiErrorElement:Type annotations are not allowed on destructuring declarations
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
@@ -450,7 +450,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Receiver type is not allowed on a multi-declaration
PsiErrorElement:Receiver type is not allowed on a destructuring declaration
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
@@ -460,7 +460,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
PsiElement(RPAR)(')')
PsiErrorElement:Type annotations are not allowed on multi-declarations
PsiErrorElement:Type annotations are not allowed on destructuring declarations
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
@@ -478,7 +478,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Multi-declarations are only allowed for local variables/values
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
PsiElement(LPAR)('(')
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
@@ -496,13 +496,13 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Receiver type is not allowed on a multi-declaration
PsiErrorElement:Receiver type is not allowed on a destructuring declaration
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(DOT)('.')
PsiErrorElement:Multi-declarations are only allowed for local variables/values
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
PsiElement(LPAR)('(')
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
@@ -520,7 +520,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Multi-declarations are only allowed for local variables/values
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
PsiElement(LPAR)('(')
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
@@ -529,7 +529,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('b')
PsiElement(RPAR)(')')
PsiErrorElement:Type annotations are not allowed on multi-declarations
PsiErrorElement:Type annotations are not allowed on destructuring declarations
PsiElement(COLON)(':')
TYPE_REFERENCE
USER_TYPE
@@ -552,7 +552,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Multi-declarations are only allowed for local variables/values
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
PsiElement(LPAR)('(')
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
@@ -570,13 +570,13 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Receiver type is not allowed on a multi-declaration
PsiErrorElement:Receiver type is not allowed on a destructuring declaration
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(DOT)('.')
PsiErrorElement:Multi-declarations are only allowed for local variables/values
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
PsiElement(LPAR)('(')
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
@@ -594,7 +594,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Multi-declarations are only allowed for local variables/values
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
PsiElement(LPAR)('(')
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('a')
@@ -603,7 +603,7 @@ JetFile: MultiVariableDeclarations.kt
MULTI_VARIABLE_DECLARATION_ENTRY
PsiElement(IDENTIFIER)('b')
PsiElement(RPAR)(')')
PsiErrorElement:Type annotations are not allowed on multi-declarations
PsiErrorElement:Type annotations are not allowed on destructuring declarations
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
@@ -372,7 +372,7 @@ JetFile: PropertiesWithFunctionReceiversRecovery.kt
MULTI_VARIABLE_DECLARATION
PsiElement(val)('val')
PsiWhiteSpace(' ')
PsiErrorElement:Receiver type is not allowed on a multi-declaration
PsiErrorElement:Receiver type is not allowed on a destructuring declaration
TYPE_REFERENCE
ANNOTATION
PsiElement(AT)('@')
@@ -414,7 +414,7 @@ JetFile: PropertiesWithFunctionReceiversRecovery.kt
PsiElement(DOT)('.')
PsiErrorElement:Expecting '.' before a property name
PsiElement(IDENTIFIER)('foo')
PsiErrorElement:Multi-declarations are only allowed for local variables/values
PsiErrorElement:Destructuring declarations are only allowed for local variables/values
PsiElement(LPAR)('(')
PsiErrorElement:Expecting a name
<empty list>
@@ -1,7 +1,7 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -27,8 +27,8 @@ operator fun Some.component2() = 3
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -1,7 +1,7 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -36,8 +36,8 @@ operator fun Some.component2() = 3
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -1,7 +1,7 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -35,8 +35,8 @@ operator fun Some.component1() = 1
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -1,7 +1,7 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type aaa.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type aaa.Some must have a 'component2()' function
package testing
@@ -37,8 +37,8 @@ operator fun Some.component2() = 3
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component1()' function
// ERROR: Multi-declaration initializer of type aaa.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type aaa.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type aaa.Some must have a 'component2()' function
package testing
@@ -1,6 +1,6 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
package testing
@@ -26,7 +26,7 @@ operator fun Some.component2() = 3
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
package testing
@@ -1,6 +1,6 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -26,7 +26,7 @@ operator fun Some.component2() = 3
// FILE: first.after.kt
// "Import" "true"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component2()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component2()' function
package testing
@@ -1,6 +1,6 @@
// FILE: first.before.kt
// "Import" "false"
// ERROR: Multi-declaration initializer of type some.Some must have a 'component1()' function
// ERROR: Destructuring declaration initializer of type some.Some must have a 'component1()' function
// ACTION: Create extension function 'component1'
// ACTION: Create member function 'component1'
@@ -130,7 +130,7 @@ public inline fun <K> Map<K, *>.containsValueRaw(value: Any?): Boolean = (this a
/**
* Returns the key component of the map entry.
*
* This method allows to use multi-declarations when working with maps, for example:
* This method allows to use destructuring declarations when working with maps, for example:
* ```
* for ((key, value) in map) {
* // do something with the key and the value
@@ -142,7 +142,7 @@ public inline operator fun <K, V> Map.Entry<K, V>.component1(): K = key
/**
* Returns the value component of the map entry.
* This method allows to use multi-declarations when working with maps, for example:
* This method allows to use destructuring declarations when working with maps, for example:
* ```
* for ((key, value) in map) {
* // do something with the key and the value