Skip to content

Allow for unqualified apply as context functions #15417

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

Merged
merged 3 commits into from
Jun 11, 2022

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 10, 2022

Fixes #15414

@odersky
Copy link
Contributor Author

odersky commented Jun 10, 2022

@smarter Yes, good suggestion.

@smarter
Copy link
Member

smarter commented Jun 10, 2022

Actually even better would be to use tpd.qualifier to handle the match: https://github.com/lampepfl/dotty/blob/9614fb9ce148e184d40948060904d0b1bd713ec0/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala#L854-L861

@smarter smarter enabled auto-merge June 10, 2022 17:26
@odersky
Copy link
Contributor Author

odersky commented Jun 11, 2022

We now don't allow single apply's to be used as constructor proxies

The previous commits allowed them but that caused runtime errors in Specs2 since
apply was bound to something different from before.

Since this is a weird corner case it's better not to allow it. As long as we do
not crash we are good.

The error message we get now is:

constructor proxy `apply` cannot be used as a value

which is also a bit strange, but since this is a truly weird corner case it's not worth it
to finetune this.

odersky added 2 commits June 11, 2022 16:17
The previous commits allowed them but that caused runtime errors in Specs2 since
`apply` was bound to something different from before.

Since this is a weird corner case it's better not to allow it. As long as we do
not crash we are good.

The error message we get now is:

    constructor proxy `apply` cannot be used as a value

which is also a bit strange, but since this is a truly weird corner case it's not worth it
to finetune this.
@smarter smarter merged commit 0260d75 into scala:main Jun 11, 2022
@smarter smarter deleted the fix-15414 branch June 11, 2022 15:42
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
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.

Bare "apply" in companion object causes MatchError crash
3 participants