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

Regression: Fix match type extraction of a MatchAlias #20111

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

smarter
Copy link
Member

@smarter smarter commented Apr 5, 2024

Previously this failed with:

14 |    val x: Base.ExtractValue[Sub[Int *: EmptyTuple]] = 1
   |                                                       ^
   |           Found:    (1 : Int)
   |           Required: Base.ExtractValue[Sub[Int *: EmptyTuple]]
   |
   |           Note: a match type could not be fully reduced:
   |
   |             trying to reduce  Base.ExtractValue[Sub[Int *: EmptyTuple]]
   |             failed since selector Sub[Int *: EmptyTuple]
   |             does not uniquely determine parameter v in
   |               case Base.BaseOf[v] => v
   |             The computed bounds for the parameter are:
   |               v = Tuple.Head[Int *: EmptyTuple]

Because the match type logic incorrectly believed that v was a non-alias TypeBounds.

This used to work in 3.3 and regressed in 3.4.0.

Previously this failed with:

```
14 |    val x: Base.ExtractValue[Sub[Int *: EmptyTuple]] = 1
   |                                                       ^
   |           Found:    (1 : Int)
   |           Required: Base.ExtractValue[Sub[Int *: EmptyTuple]]
   |
   |           Note: a match type could not be fully reduced:
   |
   |             trying to reduce  Base.ExtractValue[Sub[Int *: EmptyTuple]]
   |             failed since selector Sub[Int *: EmptyTuple]
   |             does not uniquely determine parameter v in
   |               case Base.BaseOf[v] => v
   |             The computed bounds for the parameter are:
   |               v = Tuple.Head[Int *: EmptyTuple]
```

Because the match type logic incorrectly believed that `v` was a non-alias
TypeBounds.
@smarter smarter enabled auto-merge April 5, 2024 18:38
@smarter smarter changed the title Fix match type extraction of a MatchAlias Regression: Fix match type extraction of a MatchAlias Apr 5, 2024
@smarter smarter merged commit 85672a0 into scala:main Apr 5, 2024
16 checks passed
@smarter smarter deleted the specced-alias branch April 5, 2024 20:43
smarter added a commit to dotty-staging/dotty that referenced this pull request Apr 5, 2024
….4.2

Backports scala#20111 which fixes a regression introduced in 3.4.0.
@smarter smarter added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Apr 5, 2024
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
@WojciechMazur WojciechMazur removed the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Jul 1, 2024
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.

4 participants