Open
Description
Minimized code
package patmat
object UGB {
trait Value
final case class Bar() extends Value
final case class Baz() extends Value
final case class Foo() extends Input {
type Value = Bar
}
final case class Quux() extends Input {
type Value = Baz
}
trait Input {
type Value <: UGB.Value
}
}
trait Test {
def request[Res](in: UGB.Input { type Value = Res }): Res =
in match {
case _: UGB.Foo => UGB.Bar()
case _: UGB.Quux => UGB.Baz()
}
}
Output
[error] 24 | case _: UGB.Foo => UGB.Bar()
[error] | ^^^^^^^^^
[error] | Found: patmat.UGB.Bar
[error] | Required: Res
[error] -- [E007] Type Mismatch Error: /data/temp/DottyPathDepPatProblem/src/main/scala/patmat/Test.scala:25:34
[error] 25 | case _: UGB.Quux => UGB.Baz()
[error] | ^^^^^^^^^
[error] | Found: patmat.UGB.Baz
[error] | Required: Res
[error] two errors found
Expectation
Should compile (does in Scala 2)