Allowed function parameter without type declaration in the parser
This commit is contained in:
@@ -1494,7 +1494,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
PsiBuilder.Marker parameters = mark();
|
||||
expect(LPAR, "Expecting '('", recoverySet);
|
||||
if (!atSet(recoverySet)) {
|
||||
myJetParsing.parseValueParameter();
|
||||
myJetParsing.parseValueParameter(/*typeRequired = */ true);
|
||||
expect(RPAR, "Expecting ')'", recoverySet);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -639,7 +639,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
beforeConstructorModifiers.drop();
|
||||
|
||||
if (at(LPAR)) {
|
||||
parseValueParameterList(false, TokenSet.create(COLON, LBRACE));
|
||||
parseValueParameterList(false, /* typeRequired = */ true, TokenSet.create(COLON, LBRACE));
|
||||
}
|
||||
else if (hasConstructorModifiers) {
|
||||
// A comprehensive error message for cases like:
|
||||
@@ -1253,7 +1253,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
|
||||
if (at(LPAR)) {
|
||||
parseValueParameterList(false, valueParametersFollow);
|
||||
parseValueParameterList(false, /* typeRequired = */ false, valueParametersFollow);
|
||||
}
|
||||
else {
|
||||
error("Expecting '('");
|
||||
@@ -1937,7 +1937,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
assert _at(LPAR) : tt();
|
||||
PsiBuilder.Marker functionType = mark();
|
||||
|
||||
parseValueParameterList(true, TokenSet.EMPTY);
|
||||
parseValueParameterList(true, /* typeRequired = */ true, TokenSet.EMPTY);
|
||||
|
||||
expect(ARROW, "Expecting '->' to specify return type of a function type", TYPE_REF_FIRST);
|
||||
parseTypeRef();
|
||||
@@ -1958,7 +1958,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
* : parameter ("=" element)?
|
||||
* ;
|
||||
*/
|
||||
void parseValueParameterList(boolean isFunctionTypeContents, TokenSet recoverySet) {
|
||||
void parseValueParameterList(boolean isFunctionTypeContents, boolean typeRequired, TokenSet recoverySet) {
|
||||
assert _at(LPAR);
|
||||
PsiBuilder.Marker parameters = mark();
|
||||
|
||||
@@ -1976,7 +1976,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
|
||||
if (isFunctionTypeContents) {
|
||||
if (!tryParseValueParameter()) {
|
||||
if (!tryParseValueParameter(typeRequired)) {
|
||||
PsiBuilder.Marker valueParameter = mark();
|
||||
parseModifierList(MODIFIER_LIST, REGULAR_ANNOTATIONS_ONLY_WITH_BRACKETS); // lazy, out, ref
|
||||
parseTypeRef();
|
||||
@@ -1984,7 +1984,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
}
|
||||
else {
|
||||
parseValueParameter();
|
||||
parseValueParameter(typeRequired);
|
||||
}
|
||||
|
||||
if (at(COMMA)) {
|
||||
@@ -2008,15 +2008,15 @@ public class JetParsing extends AbstractJetParsing {
|
||||
* : modifiers ("val" | "var")? parameter ("=" element)?
|
||||
* ;
|
||||
*/
|
||||
private boolean tryParseValueParameter() {
|
||||
return parseValueParameter(true);
|
||||
private boolean tryParseValueParameter(boolean typeRequired) {
|
||||
return parseValueParameter(true, typeRequired);
|
||||
}
|
||||
|
||||
public void parseValueParameter() {
|
||||
parseValueParameter(false);
|
||||
public void parseValueParameter(boolean typeRequired) {
|
||||
parseValueParameter(false, typeRequired);
|
||||
}
|
||||
|
||||
private boolean parseValueParameter(boolean rollbackOnFailure) {
|
||||
private boolean parseValueParameter(boolean rollbackOnFailure, boolean typeRequired) {
|
||||
PsiBuilder.Marker parameter = mark();
|
||||
|
||||
parseModifierListWithShortAnnotations(MODIFIER_LIST, TokenSet.create(IDENTIFIER), TokenSet.create(COMMA, RPAR, COLON));
|
||||
@@ -2025,7 +2025,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
advance(); // VAR_KEYWORD | VAL_KEYWORD
|
||||
}
|
||||
|
||||
if (!parseFunctionParameterRest() && rollbackOnFailure) {
|
||||
if (!parseFunctionParameterRest(typeRequired) && rollbackOnFailure) {
|
||||
parameter.rollbackTo();
|
||||
return false;
|
||||
}
|
||||
@@ -2039,7 +2039,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
* : parameter ("=" element)?
|
||||
* ;
|
||||
*/
|
||||
private boolean parseFunctionParameterRest() {
|
||||
private boolean parseFunctionParameterRest(boolean typeRequired) {
|
||||
boolean noErrors = true;
|
||||
|
||||
// Recovery for the case 'fun foo(Array<String>) {}'
|
||||
@@ -2055,7 +2055,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
advance(); // COLON
|
||||
parseTypeRef();
|
||||
}
|
||||
else {
|
||||
else if (typeRequired) {
|
||||
errorWithRecovery("Parameters must have type annotation", PARAMETER_NAME_RECOVERY_SET);
|
||||
noErrors = false;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun test(a<!SYNTAX!><!>) {
|
||||
fun test(<!VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION!>a<!>) {
|
||||
|
||||
}
|
||||
|
||||
class A(a<!SYNTAX!><!>)
|
||||
|
||||
val bar = fun test(a<!SYNTAX!><!>){}
|
||||
val bar = fun test(<!CANNOT_INFER_PARAMETER_TYPE!>a<!>){}
|
||||
|
||||
val la = { (<!CANNOT_INFER_PARAMETER_TYPE!>a<!>) -> }
|
||||
val las = { (a: Int) -> }
|
||||
@@ -0,0 +1,24 @@
|
||||
fun test1(a) {}
|
||||
fun test2(a = 4) {}
|
||||
fun test3(c: Int) {}
|
||||
|
||||
fun test4(ann(parameter) a) {}
|
||||
fun test5(ann a) {}
|
||||
|
||||
fun test() {
|
||||
try {
|
||||
|
||||
}
|
||||
catch(a: Int) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val a = fun (b) {}
|
||||
val a = fun (b = 4) {}
|
||||
val a = fun (b: Int) {}
|
||||
|
||||
val a: (A) -> Unit
|
||||
val a: (a: A) -> Unit
|
||||
|
||||
class A(a: Int)
|
||||
@@ -0,0 +1,283 @@
|
||||
JetFile: ParameterType.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test1')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test2')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test3')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('c')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test4')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ann')
|
||||
VALUE_ARGUMENT_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_ARGUMENT
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('parameter')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test5')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('ann')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
TRY
|
||||
PsiElement(try)('try')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
CATCH
|
||||
PsiElement(catch)('catch')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('4')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiWhiteSpace('\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -0,0 +1,25 @@
|
||||
fun test1(a:) {}
|
||||
|
||||
fun foo(inlineOptions(InlineOp)) { }
|
||||
|
||||
fun test2(ann(parameter) ) {}
|
||||
fun test3(ann ) {}
|
||||
|
||||
fun test() {
|
||||
try {
|
||||
|
||||
}
|
||||
catch(a) {
|
||||
|
||||
}
|
||||
catch(a:) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val a = fun (b:) {}
|
||||
|
||||
val a: (a:) -> Unit
|
||||
|
||||
class A(a)
|
||||
class A(a:)
|
||||
@@ -0,0 +1,223 @@
|
||||
JetFile: ParameterType_ERR.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test1')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('inlineOptions')
|
||||
PsiErrorElement:Expecting comma or ')'
|
||||
<empty list>
|
||||
PsiErrorElement:Expecting ')'
|
||||
PsiElement(LPAR)('(')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('InlineOp')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test2')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('ann')
|
||||
PsiErrorElement:Expecting comma or ')'
|
||||
<empty list>
|
||||
PsiErrorElement:Expecting ')'
|
||||
PsiElement(LPAR)('(')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('parameter')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test3')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('ann')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('test')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n ')
|
||||
TRY
|
||||
PsiElement(try)('try')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
CATCH
|
||||
PsiElement(catch)('catch')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiErrorElement:Parameters must have type annotation
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
CATCH
|
||||
PsiElement(catch)('catch')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
FUN
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(COLON)(':')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
PROPERTY
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiWhiteSpace('\n\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiErrorElement:Parameters must have type annotation
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
CLASS
|
||||
PsiElement(class)('class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('A')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COLON)(':')
|
||||
TYPE_REFERENCE
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(RPAR)(')')
|
||||
@@ -59,12 +59,12 @@ JetFile: WrongWordInParentheses.kt
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('Bar')
|
||||
PsiErrorElement:Parameters must have type annotation
|
||||
PsiElement(GT)('>')
|
||||
PsiErrorElement:Expecting comma or ')'
|
||||
<empty list>
|
||||
PsiErrorElement:Expecting ')'
|
||||
PsiElement(EXCL)('!')
|
||||
PsiElement(GT)('>')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(EXCL)('!')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiErrorElement:Expecting a top level declaration
|
||||
PsiElement(RPAR)(')')
|
||||
|
||||
@@ -465,6 +465,18 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ParameterType.kt")
|
||||
public void testParameterType() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/ParameterType.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ParameterType_ERR.kt")
|
||||
public void testParameterType_ERR() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/ParameterType_ERR.kt");
|
||||
doParsingTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Precedence.kt")
|
||||
public void testPrecedence() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/Precedence.kt");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
val v = 1
|
||||
|
||||
fun foo(inlineOptions(InlineOp<caret>) { }
|
||||
fun foo(inlineOptions(InlineOp<caret>) a: Int) { }
|
||||
|
||||
// INVOCATION_COUNT: 1
|
||||
// EXIST: InlineOption
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Resolve target: null
|
||||
----------------------------------------------
|
||||
fun foo(p: Any?, p1, Any?) {
|
||||
fun foo(p: Any?, p1: Any?) {
|
||||
/* STATEMENT DELETED: if (x()) { y(p!!) } else { z(p1!!) } */
|
||||
|
||||
<caret>xxx
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun foo(p: Any?, p1, Any?) {
|
||||
fun foo(p: Any?, p1: Any?) {
|
||||
if (x()) {
|
||||
y(p!!)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user