tree-sitter-kotlin icon indicating copy to clipboard operation
tree-sitter-kotlin copied to clipboard

allow type params before navigation suffix

Open brandonspark opened this issue 2 years ago • 2 comments

In my pursuits running the Kotlin parser on many open-source repos, I've noticed that a very common we cannot parse is expressions of the form Foo<*>::bar. It seems that this is an example of suffixing an expression with type parameters, and then doing a navigation suffix.

Unfortunately, it seems that naively writing the grammar with type parameters after arbitrary expressions is a surefire way to break comparison expressions. I decided to follow the same form as call_suffix, and instead allow type parameters in only a particular suffix, that being navigation suffixes.

Now, it works. Our parse rate went up like a percent as a result.

Test plan: Automated tests.

brandonspark avatar Mar 22 '23 06:03 brandonspark

This is awesome @brandonspark. I sincerely hope that you keep contributing! I thought that this repo was losing traction but it seems I was wrong! Thank you @fwcd and @brandonspark! :)

RenFraser avatar Mar 22 '23 21:03 RenFraser

Thanks for investigating! Please rebase it onto main (as always), so we can run CI.

fwcd avatar Mar 22 '23 23:03 fwcd