Skip to content

Conversation

kasiaMarek
Copy link
Member

@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
@WojciechMazur WojciechMazur added this to the 3.7.0 milestone Mar 11, 2025
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
4 participants