-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label
Description
Compiler version
3.2.2
Minimized code
sealed trait Foo[+A] {
def baz: A
}
sealed trait Bar[+A] extends Foo[A]
object Bar {
def unapply[A](bar: Bar[A]): Some[A] =
Some(bar.baz)
}
def someMethod[A](foo: Bar[A]): A =
???
def test[A](foo: Foo[A]): A =
foo match {
case bar @ Bar(_) => someMethod(bar)
}
Output
Found: (bar : Playground.Foo[A] & Playground.Bar[Any])
Required: Playground.Bar[A]
Expectation
I would expect that the inferred type of bar
here would be Bar[A]
instead of Bar[Any]
. This is the behavior in Scala 2 so this seems to be a regression in type inference
Metadata
Metadata
Assignees
Labels
itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" labelEvery issue needs to have an "area" and "itype" label