Skip to content

Backport "Restrict implicit args to using" to 3.3 LTS #299

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

Closed
wants to merge 2 commits into from

Conversation

tgodzik
Copy link

@tgodzik tgodzik commented Apr 24, 2025

Backports scala#22458 to the 3.3.7.

PR submitted by the release tooling.
[skip ci]

som-snytt and others added 2 commits April 24, 2025 16:57
Typer#adaptNoArgsImplicitMethod populates implicit args
when an arg list is missing. To remedy missing implicits,
it tries a named application `using` args it did find.
Then Applications#tryDefault supplies a default arg if
available. A previous fix to allow tryDefault to supply
implicit args for `implicit` params is now restricted
to explicit `using`; typer now adds `using` for `implicit`
when it needs to try defaults.

This commit restores propagatedFailure and the previous
condition that default params are tried if there is an error
that is not an ambiguity. An additional restriction is that
default params must be useful: there must be a param which
has a default arg to be added (because it's not a named arg).
Typer#adaptNoArgsImplicitMethod populates implicit args
when an arg list is missing. To remedy missing implicits,
it tries a named application `using` args it did find.
Then Applications#tryDefault supplies a default arg if
available. A previous fix to allow tryDefault to supply
implicit args for `implicit` params is now restricted
to explicit `using`; typer now adds `using` for `implicit`
when it needs to try defaults.

This commit restores propagatedFailure and the previous
condition that default params are tried if there is an error
that is not an ambiguity. An additional restriction is that
default params must be useful: there must be a param which
has a default arg to be added (because it's not a named arg).

[Cherry-picked c37dc8b][modified]
@tgodzik tgodzik closed this Apr 24, 2025
@tgodzik tgodzik deleted the backport-lts-3.3-22458 branch April 24, 2025 18:58
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.

2 participants