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

Match type for extracting type parameter fails to reduce #18488

Closed
KuceraMartin opened this issue Aug 30, 2023 · 1 comment
Closed

Match type for extracting type parameter fails to reduce #18488

KuceraMartin opened this issue Aug 30, 2023 · 1 comment

Comments

@KuceraMartin
Copy link
Contributor

Compiler version

3.3.0

Minimized code

The code is still quite big but I have not been able to minimize it further.

trait AbstractTable[T]

trait Query[E, U]

class TableQuery[E <: AbstractTable[?]] extends Query[E, Extract[E]]

type Extract[E] = E match
  case AbstractTable[t] => t

trait BaseCrudRepository[E[T[_]]]:

  type EntityTable <: AbstractTable[E[Option]]

  def filterById: Query[EntityTable, Extract[EntityTable]] =
    new TableQuery[EntityTable]

Output

[error] ./match-type.scala:15:5
[error] Match type reduction failed since selector  T
[error] matches none of the cases
[error]
[error]     case AbstractTable[t] => t
[error]     new TableQuery[EntityTable]
[error]     ^

Expectation

The code should compile. It compiles with Scala 3.1 and also with 3.4.0-RC1-bin-20230829-510aac8-NIGHTLY but not with 3.2 or 3.3.

@KuceraMartin KuceraMartin added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 30, 2023
@sjrd
Copy link
Member

sjrd commented Aug 30, 2023

Fixed with SIP-56. (i.e., works on top of #18416)

@sjrd sjrd added area:match-types and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 30, 2023
@sjrd sjrd self-assigned this Aug 30, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Aug 31, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Aug 31, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Aug 31, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Sep 1, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Sep 6, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Sep 7, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Sep 7, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Nov 24, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Nov 24, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Dec 1, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Dec 7, 2023
nicolasstucki pushed a commit to dotty-staging/dotty that referenced this issue Dec 7, 2023
sjrd added a commit to dotty-staging/dotty that referenced this issue Dec 15, 2023
sjrd added a commit to sjrd/dotty that referenced this issue Dec 18, 2023
@sjrd sjrd closed this as completed in 16cf4f2 Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants