Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: error on const generics #228

Open
2 tasks done
matthiaskrgr opened this issue Jun 2, 2024 · 0 comments
Open
2 tasks done

bug: error on const generics #228

matthiaskrgr opened this issue Jun 2, 2024 · 0 comments
Labels

Comments

@matthiaskrgr
Copy link

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • 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

the issued code looks ok on first glance, maybe just don't emit an error? code compile s fine.

Steps To Reproduce/Bad Parse Tree

source_file [0, 0] - [4, 0]
struct_item [0, 0] - [3, 1]
visibility_modifier [0, 0] - [0, 3]
name: type_identifier [0, 11] - [0, 15]
type_parameters: type_parameters [0, 15] - [0, 45]
constrained_type_parameter [0, 16] - [0, 24]
left: type_identifier [0, 16] - [0, 17]
bounds: trait_bounds [0, 17] - [0, 24]
type_identifier [0, 19] - [0, 24]
const_parameter [0, 26] - [0, 40]
name: identifier [0, 32] - [0, 33]
type: primitive_type [0, 35] - [0, 40]
ERROR [0, 41] - [0, 44]
integer_literal [0, 43] - [0, 44]
body: field_declaration_list [0, 46] - [3, 1]
field_declaration [1, 4] - [1, 16]
name: field_identifier [1, 4] - [1, 8]
type: array_type [1, 10] - [1, 16]
element: type_identifier [1, 11] - [1, 12]
length: identifier [1, 14] - [1, 15]
field_declaration [2, 4] - [2, 14]
name: field_identifier [2, 4] - [2, 9]
type: array_type [2, 11] - [2, 14]
element: type_identifier [2, 12] - [2, 13]

Expected Behavior/Parse Tree

source_file [0, 0] - [4, 0]
struct_item [0, 0] - [3, 1]
visibility_modifier [0, 0] - [0, 3]
name: type_identifier [0, 11] - [0, 15]
type_parameters: type_parameters [0, 15] - [0, 45]
constrained_type_parameter [0, 16] - [0, 24]
left: type_identifier [0, 16] - [0, 17]
bounds: trait_bounds [0, 17] - [0, 24]
type_identifier [0, 19] - [0, 24]
const_parameter [0, 26] - [0, 40]
name: identifier [0, 32] - [0, 33]
type: primitive_type [0, 35] - [0, 40]
integer_literal [0, 43] - [0, 44]
body: field_declaration_list [0, 46] - [3, 1]
field_declaration [1, 4] - [1, 16]
name: field_identifier [1, 4] - [1, 8]
type: array_type [1, 10] - [1, 16]
element: type_identifier [1, 11] - [1, 12]
length: identifier [1, 14] - [1, 15]
field_declaration [2, 4] - [2, 14]
name: field_identifier [2, 4] - [2, 9]
type: array_type [2, 11] - [2, 14]
element: type_identifier [2, 12] - [2, 13]

Repro

pub struct Loaf<T: Sized, const N: usize = 1> {
    head: [T; N],
    slice: [T],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant