Skip to content

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 3, 2024

We now try to reduce match types before computing their contributions to an implicit scope. This avoids problems where joint and separate compilations gave different results, as in #20071 and #15183.

Background: If a match type is reducible to a type R the compiler is free to replace the match type with R. That should not affect the implicit scope computation. Consequently, we have to try to reduce match types before computing their contributions to an implicit scope.

#20071 and #15183 are really the same problem. Both used to compile in sequence and both gave an implicit not found error when two files were compiled together.

In #15183 a weird match type was constructed intentionally, in order to avoid an otherwise necessary given import. That exploited a bug in the compiler which this PR fixes.

Fixes #20071

@odersky odersky marked this pull request as ready for review April 3, 2024 13:17
We now try to reduce match types before computing their contributions to an implicit scope. This avoids problems where joint and separate compilations gave different results, as in scala#20071 and scala#15183. Background: If a match type is reducible to a type R the compiler is free to replace the match type with R. That should not affect the implicit scope computation. Consequently, we have to try to reduce match types before computing their contributions to an implicit scope. scala#20071 and scala#15183 are really the same problem. Both used to compile in sequence and both gave an implicit not found error when two files were compiled together. In scala#15183 a weird match type was constructed intentionally, in order to avoid an otherwise necessary given import. That exploited a bug in the compiler which this PR fixes.
@odersky
Copy link
Contributor Author

odersky commented Apr 3, 2024

duplicate of #20077

@odersky odersky closed this Apr 3, 2024
@dwijnand dwijnand deleted the fix-20071 branch April 9, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant