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

False-positive Unreachable case warning for mix-in type test #21860

Closed
ivan-klass opened this issue Oct 30, 2024 · 1 comment · Fixed by #21876
Closed

False-positive Unreachable case warning for mix-in type test #21860

ivan-klass opened this issue Oct 30, 2024 · 1 comment · Fixed by #21876
Assignees
Labels
area:pattern-matching area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@ivan-klass
Copy link

Compiler version

3.5.2

https://scastie.scala-lang.org/7iPISGKwTfOBxOKWIRIiaw

Minimized code

trait Figure

sealed trait Corners {
  self: Figure =>
}

enum Shape extends Figure:
  case Triange extends Shape with Corners
  case Square extends Shape with Corners
  case Circle extends Shape
  case Ellipsis extends Shape


def hasCorners(s: Shape): Boolean = s match
  case hasCorners: Corners => true //  <--- reported as `Unreachable case`
  case _ => false

println(hasCorners(Shape.Circle))

Output

warning: Unreachable case

true

Expectation

true
@ivan-klass ivan-klass added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 30, 2024
@Gedochao Gedochao added area:reporting Error reporting including formatting, implicit suggestions, etc area:pattern-matching regression This worked in a previous version but doesn't anymore and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 30, 2024
@Gedochao
Copy link
Contributor

Last good stable version: 3.3.4
First bad stable version: 3.4.0

It seems bisect is failing a lot, the cause could be in any of the following commits:
1b2a16e
f432d08
2dd9f45
ec097a9

cc @sjrd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pattern-matching area:reporting Error reporting including formatting, implicit suggestions, etc 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