Skip to content

Commit c480cc8

Browse files
stackoverflowbioball
authored andcommitted
Fix bug in parsing of super expression (#1364)
1 parent 36af938 commit c480cc8

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
local baz = new Dynamic {}
3+
4+
local foo = new Dynamic {
5+
bar = 1
6+
}
7+
8+
qux {
9+
(foo) {
10+
...super.bar
11+
(baz) {
12+
qux = 1
13+
}
14+
}
15+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
qux {
2+
new {
3+
bar = 1
4+
new {
5+
qux = 1
6+
}
7+
}
8+
}

pkl-parser/src/main/java/org/pkl/parser/Parser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,9 @@ yield switch (lookahead) {
973973
if (lookahead == Token.DOT) {
974974
next();
975975
var identifier = parseIdentifier();
976-
if (lookahead == Token.LPAREN) {
976+
if (lookahead == Token.LPAREN
977+
&& !precededBySemicolon
978+
&& _lookahead.newLinesBetween == 0) {
977979
var args = parseArgumentList();
978980
yield new SuperAccessExpr(identifier, args, start.endWith(args.span()));
979981
} else {

0 commit comments

Comments
 (0)