-
Notifications
You must be signed in to change notification settings - Fork 1.1k
no warn when pattern match not exhaustive #23006
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
Comments
FWIW, I'd expect inheriting from both |
I don't see anything really wrong here with the pattern match, the final scala> def foo: Int & Boolean = ???
def foo: Int & Boolean
scala> foo == true
scala.NotImplementedError: an implementation is missing
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
at rs$line$1$.foo( what is a problem is that Scala 2.13.16 would issue an illegal inheritance error: scala> sealed trait Foo[+T]
| class Bar[+T](val t: T) extends Foo[T]
|
| class Lol extends Bar[Int](1) with Foo[Boolean]
class Lol extends Bar[Int](1) with Foo[Boolean]
^
On line 4: error: illegal inheritance;
class Lol inherits different type instances of trait Foo:
Foo[Boolean] and Foo[Int] I dont that that is necessarily bad in scala 3, but there should probably be a type error in trying to assign |
I expect that this pattern match is not exhaustive because:
Sorry, I don't see where we are assigning |
By allowing such (previously illegal) inheritance we
I really hope that this is just a blip that's going to be corrected. NB: I don't think there's anything wrong with a type
|
Yes, I believe extending both in a concrete class should be rejected. @odersky Random guess: is that something in the realm of bad-bounds checking? |
I was playing around #22993 and found the following regression.
Compiler version
3..4.3, 3.6.4, 3.7.1-RC1-bin-20250415-06886b0-NIGHTLY
(works in 3.3.5, 3.5.2)
Minimized code
https://scastie.scala-lang.org/road21/4aa1fpYiSqqRLwRXh1BmSA/2
Output
Expectation
I expect warning:
[warn] match may not be exhaustive.
The text was updated successfully, but these errors were encountered: