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

Switch mapping of context bounds to using clauses in 3.6 #21257

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jul 24, 2024

Was future before.

We can roll this out now, since we already made it an error in 3.5 to pass a normal argument to a using clause. It would be good to roll this out now since otherwise context bounds would represent an exception to the implicit priority inversion in #19300.

See discussion at the end of #19300 for details.

@odersky odersky requested a review from WojciechMazur July 24, 2024 09:50
@odersky
Copy link
Contributor Author

odersky commented Jul 24, 2024

This needs a change in scaladoc to recognize using clauses with evidence parameters as context bounds. Right now it seems the logic is that a context bound is recognized only if the evidence parameter is an implicit.

@Florian3k can you take this on? Alternatively, who else is working on scaladoc these days?

@WojciechMazur
Copy link
Contributor

Mikołaj is currently having ~2 weeks off to focus on his thesis, @Gedochao we might need to look for some else to handle the issue

@Gedochao
Copy link
Contributor

Alternatively, who else is working on scaladoc these days?

Nobody else AFAIK. So it's fair game for anyone, if Mikołaj isn't available.

@tgodzik
Copy link
Contributor

tgodzik commented Jul 24, 2024

Shouldn't this be a quick fix around https://github.com/scala/scala3/blob/main/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala#L633 ?

Last PR that touched it was #13172

We can either wait for him or try to fix it here (I think you have most context about the change and could probably change it quickest though)

@odersky odersky force-pushed the change-ctx-bounds-mapping branch from ba82d69 to b8f9c2c Compare July 24, 2024 17:05
odersky added 2 commits July 24, 2024 20:39
If we have a function like

```scala
def foo[X: CB](...)(implicit x: T)
```
always map context bounds to implicit parameters, irrespective of version.

Likewise, if we have a function
``scala
def foo[X: CB](...)(using x: T)
```
always map context bounds to "using" parameters, irrespective of version.
This avoids mixing implicit and using in one parameter list.
@KacperFKorban
Copy link
Member

It looks like similar changes as in scaladoc might be needed here and here for pc to work correctly

@odersky
Copy link
Contributor Author

odersky commented Jul 25, 2024

@KacperFKorban Thanks for the pointers!

@odersky odersky merged commit ad22fa6 into scala:main Jul 25, 2024
28 checks passed
@odersky odersky deleted the change-ctx-bounds-mapping branch July 25, 2024 14:36
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
@WojciechMazur WojciechMazur added the release-notes Should be mentioned in the release notes label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants