test: Add test for two restricted keyword cases

This commit is contained in:
Brian Anderson 2012-04-27 15:03:30 -07:00
parent bde5a842ce
commit 48368c5a07
3 changed files with 14 additions and 2 deletions

View File

@ -1395,7 +1395,7 @@ fn parse_pat(p: parser) -> @ast::pat {
subpat = parse_pat(p);
} else {
if is_restricted_keyword(p, fieldname) {
p.fatal("found " + fieldname + " in binding position");
p.fatal("found `" + fieldname + "` in binding position");
}
subpat = @{id: p.get_id(),
node: ast::pat_ident(fieldpath, none),
@ -2149,7 +2149,7 @@ fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item {
// Newtype syntax
if p.token == token::EQ {
if is_restricted_keyword(p, id) {
p.fatal("found " + id + " in enum constructor position");
p.fatal("found `" + id + "` in enum constructor position");
}
p.bump();
let ty = parse_ty(p, false);

View File

@ -0,0 +1,7 @@
// error-pattern:found `let` in binding position
fn main() {
alt true {
{let} { }
}
}

View File

@ -0,0 +1,5 @@
// error-pattern:found `let` in enum constructor position
fn main() {
enum let = int;
}