tree-sitter-rust
tree-sitter-rust copied to clipboard
bug: error on impl trait for dyn trait
Did you check existing issues?
- [X] I have read all the tree-sitter docs if it relates to using the parser
- [X] I have searched the existing issues of tree-sitter-rust
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
No response
Describe the bug
FP error as rustc accepts this code (although with a warning)
Steps To Reproduce/Bad Parse Tree
(source_file (trait_item (visibility_modifier) name: (type_identifier) body: (declaration_list)) (impl_item trait: (type_identifier) (ERROR) type: (bounded_type (tuple_type (scoped_type_identifier path: (scoped_identifier path: (scoped_identifier name: (identifier)) name: (identifier)) name: (type_identifier))) (type_identifier)) body: (declaration_list)))
source_file [0, 0] - [5, 0] trait_item [0, 0] - [0, 25] visibility_modifier [0, 0] - [0, 3] name: type_identifier [0, 17] - [0, 22] body: declaration_list [0, 23] - [0, 25] impl_item [2, 0] - [2, 54] trait: type_identifier [2, 12] - [2, 17] ERROR [2, 22] - [2, 25] type: bounded_type [2, 26] - [2, 50] tuple_type [2, 26] - [2, 43] scoped_type_identifier [2, 27] - [2, 42] path: scoped_identifier [2, 27] - [2, 37] path: scoped_identifier [2, 27] - [2, 32] name: identifier [2, 29] - [2, 32] name: identifier [2, 34] - [2, 37] name: type_identifier [2, 39] - [2, 42] type_identifier [2, 46] - [2, 50] body: declaration_list [2, 51] - [2, 54]
Expected Behavior/Parse Tree
looks like ts does not know about impl .. for dyn yet. I guess the `dyn' should just be part of the bounded type?
Repro
pub unsafe trait Trait {}
unsafe impl Trait for dyn (::std::any::Any) + Send { }