syntax: Fix parsing of inherent traits

This commit is contained in:
Brian Anderson 2012-08-07 13:01:15 -07:00
parent 2772b2e5c7
commit 92ef17aaeb
2 changed files with 22 additions and 1 deletions

View File

@ -2436,7 +2436,8 @@ class parser {
!self.token_is_keyword(~"of", self.look_ahead(1)) &&
!self.token_is_keyword(~"for", self.look_ahead(1)) &&
self.look_ahead(1) != token::BINOP(token::SLASH) &&
self.look_ahead(1) != token::LT {
(self.look_ahead(1) != token::LT
|| (self.look_ahead(1) == token::LT && tps.is_not_empty())) {
// This is a new-style impl declaration.
ident = @~"__extensions__"; // XXX: clownshoes

View File

@ -0,0 +1,20 @@
enum option_<T> {
none_,
some_(T),
}
impl<T> option_<T> {
fn foo() -> bool { true }
}
enum option__ {
none__,
some__(int)
}
impl option__ {
fn foo() -> bool { true }
}
fn main() {
}