Skip to content

allow method calls on integers to start with a _#294

Open
m4rch3n1ng wants to merge 3 commits intotree-sitter:masterfrom
m4rch3n1ng:int-method-call-underscore
Open

allow method calls on integers to start with a _#294
m4rch3n1ng wants to merge 3 commits intotree-sitter:masterfrom
m4rch3n1ng:int-method-call-underscore

Conversation

@m4rch3n1ng
Copy link
Copy Markdown
Contributor

@m4rch3n1ng m4rch3n1ng commented Oct 25, 2025

this basically allows for 42._method() to properly parse as the call of the method _method on the integer 42.

the FLOAT_LITERAL reference explicitly states not immediately followed by ., _ or an XID_Start character for the character after an ending dot, so disallow this here too.

this fixes exactly one rustc test: integer-literal-method-call-underscore.rs, the test that was for exactly this behaviour.

(noticed this while working on #293)

@wetneb
Copy link
Copy Markdown

wetneb commented Oct 26, 2025

Looks great to me, thank you :)

@m4rch3n1ng m4rch3n1ng force-pushed the int-method-call-underscore branch from 551f7e5 to fe84bf5 Compare March 29, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants