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

SyntaxNodes are never equal #450

Closed
LilithHafner opened this issue Jul 6, 2024 · 0 comments · Fixed by #452
Closed

SyntaxNodes are never equal #450

LilithHafner opened this issue Jul 6, 2024 · 0 comments · Fixed by #452
Labels
enhancement New feature or request

Comments

@LilithHafner
Copy link
Member

Because they use the === fallback, SyntaxNodes are never equal, even when they are semantically equivalent. For example,

julia> x = JuliaSyntax.parse(Expr, "1+1 == 2")
:(1 + 1 == 2)

julia> y = JuliaSyntax.parse(Expr, "1+1 == 2")
:(1 + 1 == 2)

julia> x == y
true

julia> x = JuliaSyntax.parse(SyntaxNode, "1+1 == 2")
line:col│ tree                                   │ file_name
   1:1  │[call-i]
   1:1  │  [call-i]
   1:1  │    1
   1:2  │    +
   1:3  │    1
   1:5  │  ==
   1:8  │  2


julia> y = JuliaSyntax.parse(SyntaxNode, "1+1 == 2")
line:col│ tree                                   │ file_name
   1:1  │[call-i]
   1:1  │  [call-i]
   1:1  │    1
   1:2  │    +
   1:3  │    1
   1:5  │  ==
   1:8  │  2


julia> x == y
false

It'd be nice if I could check if two things parsed equally using ==.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant