Skip to content

Commit 8a7f2e0

Browse files
committed
Parse nil literals (including in patterns)
Closes #622.
1 parent 67e9fe5 commit 8a7f2e0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/comp/syntax/parse/parser.rs

+5
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,11 @@ fn parse_lit(&parser p) -> ast::lit {
653653
p.bump();
654654
lit = ast::lit_str(p.get_str(s), ast::sk_rc);
655655
}
656+
case (token::LPAREN) {
657+
p.bump();
658+
expect(p, token::RPAREN);
659+
lit = ast::lit_nil;
660+
}
656661
case (?t) { unexpected(p, t); }
657662
}
658663
}

src/test/run-pass/nil-pattern.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// xfail-stage0
2+
fn main() {
3+
auto x = ();
4+
alt (x) {
5+
case (()) {
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)