test: Add test for two restricted keyword cases
This commit is contained in:
parent
bde5a842ce
commit
48368c5a07
|
@ -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);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// error-pattern:found `let` in binding position
|
||||
|
||||
fn main() {
|
||||
alt true {
|
||||
{let} { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// error-pattern:found `let` in enum constructor position
|
||||
|
||||
fn main() {
|
||||
enum let = int;
|
||||
}
|
Loading…
Reference in New Issue