Merge pull request #215 from lopekpl/KT-1019

KT-1019 recover from missing parentheses in function declaration
This commit is contained in:
Andrey Breslav
2013-03-01 01:24:26 -08:00
7 changed files with 75 additions and 35 deletions
@@ -0,0 +1,6 @@
class A {
fun foo
class B {}
fun bar
}
class C {}
@@ -0,0 +1,50 @@
JetFile: FunctionNoParameterList.kt
NAMESPACE_HEADER
<empty list>
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
TYPE_PARAMETER_LIST
<empty list>
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
PsiErrorElement:Expecting '('
<empty list>
PsiWhiteSpace('\n ')
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('B')
PsiWhiteSpace(' ')
TYPE_PARAMETER_LIST
<empty list>
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('bar')
PsiErrorElement:Expecting '('
<empty list>
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('C')
PsiWhiteSpace(' ')
TYPE_PARAMETER_LIST
<empty list>
CLASS_BODY
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
-1
View File
@@ -1,5 +1,4 @@
fun foo)
fun [a] f foo()
fun [a] T.foo(a : ) : bar
fun [a()] T.foo<>(a : foo) : bar
fun [a()] T.foo<T, , T>(a : foo) : bar
+4 -29
View File
@@ -5,35 +5,10 @@ JetFile: Functions_ERR.jet
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiErrorElement:Expecting '(
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
ANNOTATION
PsiElement(LBRACKET)('[')
ANNOTATION_ENTRY
CONSTRUCTOR_CALLEE
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiElement(RBRACKET)(']')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f')
PsiWhiteSpace(' ')
VALUE_PARAMETER_LIST
PsiErrorElement:Expecting '(
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER
PsiErrorElement:Parameter name expected
PsiElement(LPAR)('(')
PsiErrorElement:Parameters must have type annotation
<empty list>
PsiElement(RPAR)(')')
PsiErrorElement:Expecting '('
<empty list>
PsiErrorElement:Expecting package directive or top level declaration
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')