-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Compiler version
3.7.2 (works in scala 2)
Minimized code
object test {
sealed trait A[T]
case class O[T](e: A[T]) extends A[Option[T]]
def opt[U](v: Option[U], a: A[U]) = ???
def f[T](a: A[T], t: T) = {
a match {
case O(i) => opt(t, i)
}
}
}
Output
-- [E007] Type Mismatch Error: match_opt.scala:10:23 ---------------------------
10 | case O(i) => opt(t, i)
| ^
| Found: (t : T)
| Required: Option[T$1]
|
| where: T is a type in method f which is an alias of Option[T$1]
|
| longer explanation available when compiling with `-explain`
1 error found
Expectation
Should compile without errors.
Extra
Switching the order of the arguments to opt
makes the error goes away.