syntax: Fix parsing of inherent traits
This commit is contained in:
parent
2772b2e5c7
commit
92ef17aaeb
2 changed files with 22 additions and 1 deletions
|
@ -2436,7 +2436,8 @@ class parser {
|
||||||
!self.token_is_keyword(~"of", self.look_ahead(1)) &&
|
!self.token_is_keyword(~"of", self.look_ahead(1)) &&
|
||||||
!self.token_is_keyword(~"for", 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::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.
|
// This is a new-style impl declaration.
|
||||||
ident = @~"__extensions__"; // XXX: clownshoes
|
ident = @~"__extensions__"; // XXX: clownshoes
|
||||||
|
|
20
src/test/run-pass/impl-implicit-trait.rs
Normal file
20
src/test/run-pass/impl-implicit-trait.rs
Normal 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() {
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue