diff --git a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java index 49aaec5165c..78d0981d67b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java +++ b/compiler/frontend/src/org/jetbrains/jet/JetNodeTypes.java @@ -75,6 +75,7 @@ public interface JetNodeTypes { @Deprecated // Tuples are to be removed in Kotlin M4 JetNodeType TUPLE_TYPE = new JetNodeType("TUPLE_TYPE", JetTupleType.class); JetNodeType FUNCTION_TYPE = new JetNodeType("FUNCTION_TYPE", JetFunctionType.class); + JetNodeType FUNCTION_TYPE_RECEIVER = new JetNodeType("FUNCTION_TYPE_RECEIVER", JetFunctionTypeReceiver.class); JetNodeType SELF_TYPE = new JetNodeType("SELF_TYPE", JetSelfType.class); JetNodeType NULLABLE_TYPE = new JetNodeType("NULLABLE_TYPE", JetNullableType.class); JetNodeType TYPE_PROJECTION = new JetNodeType("TYPE_PROJECTION", JetTypeProjection.class); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java index 1d06761468e..d63f9dc663d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -1428,8 +1428,10 @@ public class JetParsing extends AbstractJetParsing { // A.(B) -> C // ^ - PsiBuilder.Marker precede = typeRefMarker.precede(); + PsiBuilder.Marker functionType = typeRefMarker.precede(); + PsiBuilder.Marker receiverType = typeRefMarker.precede(); typeRefMarker.done(TYPE_REFERENCE); + receiverType.done(FUNCTION_TYPE_RECEIVER); advance(); // DOT @@ -1439,9 +1441,9 @@ public class JetParsing extends AbstractJetParsing { else { error("Expecting function type"); } - typeRefMarker = precede.precede(); + typeRefMarker = functionType.precede(); - precede.done(FUNCTION_TYPE); + functionType.done(FUNCTION_TYPE); } // myBuilder.restoreJoiningComplexTokensState(); return typeRefMarker; @@ -1607,7 +1609,7 @@ public class JetParsing extends AbstractJetParsing { /* * functionType - * : (type ".")? "(" (parameter | modifiers type){","}? ")" "->" type? + * : "(" (parameter | modifiers type){","}? ")" "->" type? * ; */ private void parseFunctionType() { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java index 36caa311464..717a9ad170c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionType.java @@ -18,8 +18,6 @@ package org.jetbrains.jet.lang.psi; import com.google.common.collect.Lists; import com.intellij.lang.ASTNode; -import com.intellij.psi.PsiElement; -import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.JetNodeTypes; @@ -82,34 +80,15 @@ public class JetFunctionType extends JetTypeElement { @Nullable public JetTypeReference getReceiverTypeRef() { - PsiElement child = getFirstChild(); - while (child != null) { - IElementType tt = child.getNode().getElementType(); - if (tt == JetTokens.LPAR || tt == RETURN_TYPE_SEPARATOR) break; - if (child instanceof JetTypeReference) { - return (JetTypeReference) child; - } - child = child.getNextSibling(); + JetFunctionTypeReceiver receiverDeclaration = (JetFunctionTypeReceiver) findChildByType(JetNodeTypes.FUNCTION_TYPE_RECEIVER); + if (receiverDeclaration == null) { + return null; } - - return null; + return receiverDeclaration.getTypeReference(); } @Nullable public JetTypeReference getReturnTypeRef() { - boolean colonPassed = false; - PsiElement child = getFirstChild(); - while (child != null) { - IElementType tt = child.getNode().getElementType(); - if (tt == RETURN_TYPE_SEPARATOR) { - colonPassed = true; - } - if (colonPassed && child instanceof JetTypeReference) { - return (JetTypeReference) child; - } - child = child.getNextSibling(); - } - - return null; + return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionTypeReceiver.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionTypeReceiver.java new file mode 100644 index 00000000000..ad764abcd92 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetFunctionTypeReceiver.java @@ -0,0 +1,32 @@ +/* + * Copyright 2010-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.psi; + +import com.intellij.lang.ASTNode; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.JetNodeTypes; + +public class JetFunctionTypeReceiver extends JetElementImpl { + public JetFunctionTypeReceiver(@NotNull ASTNode node) { + super(node); + } + + @NotNull + public JetTypeReference getTypeReference() { + return (JetTypeReference) findChildByType(JetNodeTypes.TYPE_REFERENCE); + } +} diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/funcitonTypes.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/funcitonTypes.kt new file mode 100644 index 00000000000..a46f2233519 --- /dev/null +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/funcitonTypes.kt @@ -0,0 +1 @@ +class A : (categoryName: ) { \ No newline at end of file diff --git a/compiler/testData/psi/FunctionTypes.txt b/compiler/testData/psi/FunctionTypes.txt index 28a77a7562a..bb0e541051f 100644 --- a/compiler/testData/psi/FunctionTypes.txt +++ b/compiler/testData/psi/FunctionTypes.txt @@ -459,42 +459,11 @@ JetFile: FunctionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - TUPLE_TYPE - PsiElement(HASH)('#') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(type)('type') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - TYPE_PARAMETER_LIST - - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -519,9 +488,61 @@ JetFile: FunctionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + TUPLE_TYPE + PsiElement(HASH)('#') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + TYPEDEF + PsiElement(type)('type') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') TYPE_ARGUMENT_LIST @@ -530,26 +551,8 @@ JetFile: FunctionTypes.jet TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') + PsiElement(IDENTIFIER)('x') PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiElement(GT)('>') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -574,62 +577,21 @@ JetFile: FunctionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - TUPLE_TYPE - PsiElement(HASH)('#') - PsiElement(LPAR)('(') - PsiElement(RPAR)(')') - PsiWhiteSpace('\n') - TYPEDEF - PsiElement(type)('type') - PsiWhiteSpace(' ') - PsiElement(IDENTIFIER)('f') - PsiWhiteSpace(' ') - TYPE_PARAMETER_LIST - - PsiElement(EQ)('=') - PsiWhiteSpace(' ') - TYPE_REFERENCE - FUNCTION_TYPE - TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - USER_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -654,19 +616,81 @@ JetFile: FunctionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - ANNOTATION - PsiElement(LBRACKET)('[') - ANNOTATION_ENTRY - CONSTRUCTOR_CALLEE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('a') - PsiElement(RBRACKET)(']') - PsiWhiteSpace(' ') - USER_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + PsiElement(DOT)('.') + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + TUPLE_TYPE + PsiElement(HASH)('#') + PsiElement(LPAR)('(') + PsiElement(RPAR)(')') + PsiWhiteSpace('\n') + TYPEDEF + PsiElement(type)('type') + PsiWhiteSpace(' ') + PsiElement(IDENTIFIER)('f') + PsiWhiteSpace(' ') + TYPE_PARAMETER_LIST + + PsiElement(EQ)('=') + PsiWhiteSpace(' ') + TYPE_REFERENCE + FUNCTION_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + ANNOTATION + PsiElement(LBRACKET)('[') + ANNOTATION_ENTRY + CONSTRUCTOR_CALLEE + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('a') + PsiElement(RBRACKET)(']') + PsiWhiteSpace(' ') + USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') + TYPE_ARGUMENT_LIST + PsiElement(LT)('<') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('A') + PsiElement(COMMA)(',') + PsiWhiteSpace(' ') + TYPE_PROJECTION + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('B') + PsiElement(GT)('>') + PsiElement(DOT)('.') REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('T') TYPE_ARGUMENT_LIST @@ -675,26 +699,8 @@ JetFile: FunctionTypes.jet TYPE_REFERENCE USER_TYPE REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('A') - PsiElement(COMMA)(',') - PsiWhiteSpace(' ') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') + PsiElement(IDENTIFIER)('x') PsiElement(GT)('>') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') - TYPE_ARGUMENT_LIST - PsiElement(LT)('<') - TYPE_PROJECTION - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('x') - PsiElement(GT)('>') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') diff --git a/compiler/testData/psi/LocalDeclarations.txt b/compiler/testData/psi/LocalDeclarations.txt index fa7281318f7..bafc7e90c8e 100644 --- a/compiler/testData/psi/LocalDeclarations.txt +++ b/compiler/testData/psi/LocalDeclarations.txt @@ -111,10 +111,11 @@ JetFile: LocalDeclarations.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') diff --git a/compiler/testData/psi/examples/Builder.txt b/compiler/testData/psi/examples/Builder.txt index fa67bc0c3cb..375217cf18e 100644 --- a/compiler/testData/psi/examples/Builder.txt +++ b/compiler/testData/psi/examples/Builder.txt @@ -400,10 +400,11 @@ JetFile: Builder.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Library') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Library') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') diff --git a/compiler/testData/psi/examples/With.txt b/compiler/testData/psi/examples/With.txt index 1b439e8efa7..832d102888b 100644 --- a/compiler/testData/psi/examples/With.txt +++ b/compiler/testData/psi/examples/With.txt @@ -41,10 +41,11 @@ JetFile: With.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('T') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('T') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') diff --git a/compiler/testData/psi/greatSyntacticShift/functionTypes.txt b/compiler/testData/psi/greatSyntacticShift/functionTypes.txt index d1da2d361c7..79630e4affa 100644 --- a/compiler/testData/psi/greatSyntacticShift/functionTypes.txt +++ b/compiler/testData/psi/greatSyntacticShift/functionTypes.txt @@ -360,10 +360,11 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -393,14 +394,15 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('n') + PsiElement(DOT)('.') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('n') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') + PsiElement(IDENTIFIER)('B') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -430,12 +432,13 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - NULLABLE_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(QUEST)('?') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(QUEST)('?') PsiWhiteSpace(' ') PsiElement(DOT)('.') VALUE_PARAMETER_LIST @@ -466,14 +469,15 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - PsiElement(LPAR)('(') - NULLABLE_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(QUEST)('?') - PsiElement(RPAR)(')') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(QUEST)('?') + PsiElement(RPAR)(')') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -568,25 +572,26 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - PsiElement(LPAR)('(') - FUNCTION_TYPE - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -887,10 +892,11 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -924,14 +930,15 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - USER_TYPE + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE USER_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('n') + PsiElement(DOT)('.') REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('n') - PsiElement(DOT)('.') - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('B') + PsiElement(IDENTIFIER)('B') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -965,12 +972,13 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - NULLABLE_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(QUEST)('?') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(QUEST)('?') PsiWhiteSpace(' ') PsiElement(DOT)('.') VALUE_PARAMETER_LIST @@ -1005,14 +1013,15 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - PsiElement(LPAR)('(') - NULLABLE_TYPE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(QUEST)('?') - PsiElement(RPAR)(')') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + NULLABLE_TYPE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(QUEST)('?') + PsiElement(RPAR)(')') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') @@ -1123,29 +1132,30 @@ JetFile: functionTypes.jet PsiWhiteSpace(' ') TYPE_REFERENCE FUNCTION_TYPE - TYPE_REFERENCE - PsiElement(LPAR)('(') - FUNCTION_TYPE - VALUE_PARAMETER_LIST - PsiElement(LPAR)('(') - VALUE_PARAMETER - PsiElement(IDENTIFIER)('a') - PsiWhiteSpace(' ') - PsiElement(COLON)(':') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') - PsiWhiteSpace(' ') - PsiElement(ARROW)('->') - PsiWhiteSpace(' ') - TYPE_REFERENCE - USER_TYPE - REFERENCE_EXPRESSION - PsiElement(IDENTIFIER)('Int') - PsiElement(RPAR)(')') + FUNCTION_TYPE_RECEIVER + TYPE_REFERENCE + PsiElement(LPAR)('(') + FUNCTION_TYPE + VALUE_PARAMETER_LIST + PsiElement(LPAR)('(') + VALUE_PARAMETER + PsiElement(IDENTIFIER)('a') + PsiWhiteSpace(' ') + PsiElement(COLON)(':') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') + PsiWhiteSpace(' ') + PsiElement(ARROW)('->') + PsiWhiteSpace(' ') + TYPE_REFERENCE + USER_TYPE + REFERENCE_EXPRESSION + PsiElement(IDENTIFIER)('Int') + PsiElement(RPAR)(')') PsiElement(DOT)('.') VALUE_PARAMETER_LIST PsiElement(LPAR)('(') diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index 6766718cf9e..eb567d57145 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -1656,6 +1656,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage doTest("compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/funKeyword.kt"); } + @TestMetadata("funcitonTypes.kt") + public void testFuncitonTypes() throws Exception { + doTest("compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/funcitonTypes.kt"); + } + @TestMetadata("incompleteVal.kt") public void testIncompleteVal() throws Exception { doTest("compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteVal.kt");