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

Type avoidance in MT bound inference #22142

Merged
merged 4 commits into from
Dec 9, 2024
Merged

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Dec 4, 2024

Fixes #21256

Fixes tests/pos/i18211.scala, where type avoidance would cause `S[? <:
Int]` which would otherwise be consider an unreducible wild and lead to
Any which isn't <: Int.
@dwijnand dwijnand marked this pull request as ready for review December 4, 2024 18:53
@dwijnand dwijnand requested a review from sjrd December 4, 2024 18:53
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

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

Looks very good!

@@ -4633,6 +4633,7 @@ object Types extends TypeUtils {
*/
def isUnreducibleWild(using Context): Boolean =
tycon.isLambdaSub && hasWildcardArg && !isMatchAlias
&& !(args.sizeIs == 1 && defn.isCompiletime_S(tycon.typeSymbol)) // S is a pseudo Match Alias
Copy link
Member

Choose a reason for hiding this comment

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

compiletime.ops.S is intrinsic right? Maybe we could alter symbol / type somehow (in definitions?) to make isMatchAlias true?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, there's an argument for that, but I didn't feel like pushing my luck today attempting that..

@dwijnand dwijnand removed the request for review from sjrd December 9, 2024 21:03
@dwijnand dwijnand merged commit 1775d0b into scala:main Dec 9, 2024
29 checks passed
@dwijnand dwijnand deleted the mt/avoid-bounds branch December 9, 2024 21:04
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.

The auto-approximated bound for match types leaks type captures
3 participants