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

fix: map name position to desugared version of named context bound #22374

Merged
merged 2 commits into from
Jan 20, 2025

Conversation

kasiaMarek
Copy link
Contributor

@kasiaMarek kasiaMarek commented Jan 15, 2025

resolves: #22335
This PR changes the positions so context bound name position is correctly mapped in the desugaring:

def aa[T : Numeric as num]() = ??? // original code
def aa[T >: Nothing <: Any]()(using num: Numeric[T]): Nothing = ??? // desugared code, where position of `num` points to `num` in the original code

This also affects the cases where context bound is not named. The definition position of evidence$0 changed:

def aa[T : Numeric]() = ??? // original code
def aa[T >: Nothing <: Any]()(using evidence$0: Numeric[T]): Nothing = ??? // desugared code
// previously position of evidence$0 in original code
def aa[T : <<>>Numeric]() = ???
// after this PR
def aa[T : Numeric<<>>]() = ???

Which I think makes sense since if the was a name it would go after the context bound

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@tgodzik tgodzik merged commit db23c08 into scala:main Jan 20, 2025
29 checks passed
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.

No hover for named context bound
3 participants