提交 28e16cc2 编写于 作者: A Andrey Breslav

Parenthesis are mandatory after a constructor call (due to problems with 'new Foo?isValid()')

上级 b46543b8
......@@ -221,7 +221,7 @@ expressions
;
constructorInvocation
: userType valueArguments?
: userType valueArguments
;
arrayAccess
......
......@@ -1361,7 +1361,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
* "new" constructorInvocation // identical to new nunctionCall
*
* constructorInvocation
* : userType valueArguments?
* : userType valueArguments
*/
private void parseNew() {
assert _at(NEW_KEYWORD);
......@@ -1370,10 +1370,8 @@ public class JetExpressionParsing extends AbstractJetParsing {
advance(); // NEW_KEYWORD
myJetParsing.parseTypeRef();
parseValueArgumentList();
if (!eol() && at(LPAR)) {
parseValueArgumentList();
}
creation.done(NEW);
}
......
fun a(
a : foo = throw new Foo,
a : foo = throw new Foo(),
a : foo = return 10,
a : foo = break,
a : foo = break @la,
......
......@@ -31,6 +31,9 @@ JetFile: ControlStructures.jet
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace('\n ')
VALUE_PARAMETER
......
......@@ -21,10 +21,10 @@ fun a(
a : foo = typeof(10),
a : foo = new Foo(bar),
a : foo = new Foo<A>(bar),
a : foo = new Foo,
a : foo = new Foo<bar>,
a : foo = new Foo(),
a : foo = new Foo<bar>(),
a : foo = object Foo{},
a : foo = throw new Foo,
a : foo = throw new Foo(),
a : foo = return 10,
a : foo = break,
a : foo = break @la,
......
......@@ -435,6 +435,9 @@ JetFile: SimpleExpressions.jet
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace('\n ')
VALUE_PARAMETER
......@@ -464,6 +467,9 @@ JetFile: SimpleExpressions.jet
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
PsiElement(GT)('>')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace('\n ')
VALUE_PARAMETER
......@@ -514,6 +520,9 @@ JetFile: SimpleExpressions.jet
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Foo')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(COMMA)(',')
PsiWhiteSpace('\n ')
VALUE_PARAMETER
......
......@@ -22,7 +22,7 @@ import util.*
new X<String>() `plus`+ "1"
new X<String>() `plus`plus "sadfas"
new X<String>().`plus`plus("")
val x = new X<String>
val x = new X<String>()
x `minus`- ""
x `times`* ""
x `div`/ ""
......@@ -51,7 +51,7 @@ import util.*
fun <T> tt(t : T) : T {
val x : List = 0
x`java::java.util.List.get()`[1]
val foo = new Bar
val foo = new Bar()
foo`!`[null, 1]
foo`get2`[1, 1]
foo`get1`[1]
......@@ -62,7 +62,7 @@ fun <T> tt(t : T) : T {
x`!`[null] = null
(x`!`[null, 2]) = null
(`not`!foo)[1]`:std::Char`
val y = new Bar
val y = new Bar()
y`inc`++
`inc`++y
`dec`--y
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册