Skip to content

Regression in match exhaustivity of higher-kinded types #17230

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
WojciechMazur opened this issue Apr 11, 2023 · 11 comments · Fixed by #18303
Closed

Regression in match exhaustivity of higher-kinded types #17230

WojciechMazur opened this issue Apr 11, 2023 · 11 comments · Fixed by #18303
Assignees
Labels
area:pattern-matching itype:bug regression This worked in a previous version but doesn't anymore

Comments

@WojciechMazur
Copy link
Contributor

Compiler version

3.3.1-RC1-bin-20230407-bcaa1ca-NIGHTLY

Minimized code

Based on Open CB failure https://github.com/VirtusLab/community-build3/actions/runs/4650721329/jobs/8230332752 for rescala-lang/rescala

import scala.util.* 

trait Transaction {
  type State[_]
}
object Transaction {
  type of[S[_]] = Transaction { type State[A] = S[A] }
}
trait DynamicScope[State[_]]

case class ScopeSearch[State[_]](self: Either[Transaction.of[State], DynamicScope[State]]) {

  def embedTransaction[T](f: Transaction.of[State] => T): T =
    self match {
      case Left(integrated) => ??? 
      case Right(ds)        => ???
    }
}

Output

Compiling project (Scala 3.3.1-RC1-bin-20230407-bcaa1ca-NIGHTLY, JVM)
[warn] ./test.scala:13:5
[warn] match may not be exhaustive.
[warn] 
[warn] It would fail on pattern case: Left(_)
[warn]     self match {
[warn]     ^^^^
Compiled project (Scala 3.3.1-RC1-bin-20230407-bcaa1ca-NIGHTLY, JVM)

Expectation

Should not give warning

@WojciechMazur WojciechMazur added itype:bug area:pattern-matching regression This worked in a previous version but doesn't anymore labels Apr 11, 2023
@WojciechMazur
Copy link
Contributor Author

Bisect points to a range of commits 0df5ae2 .. 8020c77 , but further bisect was failing due to some other issues:

Last good release: 3.3.1-RC1-bin-20230301-0df5ae2-NIGHTLY
First bad release: 3.3.1-RC1-bin-20230302-8020c77-NIGHTLY

@WojciechMazur WojciechMazur added this to the Future versions milestone Apr 12, 2023
@mbovel mbovel added the Spree Suitable for a future Spree label Apr 14, 2023
@scala-center-bot
Copy link

This issue was picked for the Issue Spree No. 29 of 18 April 2023 which takes place in a week from now. @dwijnand, @natsukagami, @TheElectronWill, @XLPI will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

@dwijnand dwijnand changed the title Regression in match exhoustivity of higher-kinded types Regression in match exhaustivity of higher-kinded types Apr 18, 2023
@dwijnand
Copy link
Member

Minimised

trait Foo:
  type Bar[_]

object Foo:
  type Aux[B[_]] = Foo { type Bar[A] = B[A] }

class Test:
  def test[B[_]](self: Option[Foo.Aux[B]]) = self match
    case Some(b)             => 1
    case None                => 2

@XLPI
Copy link

XLPI commented May 3, 2023

Guys, is anybody continue to work on this issue? How actually our workflow in Compiler Academy is should going? @scala-center-bot

@scala-center-bot
Copy link

This issue was picked for the Issue Spree No. 30 of 09 May 2023 which takes place in a week from now. @dwijnand, @XLPI will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

@mbovel
Copy link
Member

mbovel commented May 6, 2023

Guys, is anybody continue to work on this issue? How actually our workflow in Compiler Academy is should going?

I re-assigned you to work on this with Dale during next spree. Is that okay with you?

@scala-center-bot

This comment was marked as outdated.

@scala-center-bot

This comment was marked as outdated.

@mbovel
Copy link
Member

mbovel commented May 28, 2023

Please ignore the 2 previous message from the Scala Center bot. Teams for the next spree can be found here: https://airtable.com/shrSni1OItSuErosU/tblLEWc2ISeGHPbsc. Sorry for the spam!

@dwijnand dwijnand removed the Spree Suitable for a future Spree label May 31, 2023
@mbovel
Copy link
Member

mbovel commented Jul 11, 2023

What is the current status of this issue? It has been investigated during 2 sprees; what were the conclusions?

@dwijnand
Copy link
Member

If I remember correctly, it's due to a difference in how type variables are instantiated in the Space engine. I'll got this on my list to come back to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pattern-matching itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants