Closed andryak closed 7 months ago
The parser does not recognise typed collection initializers.
This is valid Hack code to generate a vector of strings:
$x = Vector<string> {'foo', 'bar'};
Yet, the parser does not recognize the syntax and mistakes it for a function pointer:
(expression_statement (function_pointer (qualified_identifier (identifier)) (type_arguments (type_specifier))) (MISSING ";")) (compound_statement (ERROR (string) (string))) (empty_statement))
Add Set<string> {'foo', 'bar'}; to the Collection test in test/corpus/expressions.txt, then run tree-sitter test.
Set<string> {'foo', 'bar'};
Collection
test/corpus/expressions.txt
tree-sitter test
No errors are reported in the syntax tree.
Issue is more general that Set<type arguments> { ... }, applies to Map(s) and Vector(s) as well, possibly to more types.
Set<type arguments> { ... }
Describe the bug
The parser does not recognise typed collection initializers.
This is valid Hack code to generate a vector of strings:
Yet, the parser does not recognize the syntax and mistakes it for a function pointer:
Requirements
To Reproduce
Add
Set<string> {'foo', 'bar'};
to theCollection
test intest/corpus/expressions.txt
, then runtree-sitter test
.Expected behavior
No errors are reported in the syntax tree.
Additional context
Issue is more general that
Set<type arguments> { ... }
, applies to Map(s) and Vector(s) as well, possibly to more types.