You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
object Foo {
case class Baz[F[_]](f: F[Int])
type ListOption[A] = List[Option[A]]
val l: List[Option[Int]] = List(Option(7))
val l2: ListOption[Int] = l
val l3: ({type l[a] = List[Option[a]]})#l[Int] = l
val baz = Baz(l) //infers Baz[Any]
val bup = Baz(l2) //correctly infers Baz[ListOption]
val bur = Baz(l3) //infers Baz[Any] again
}
val l: List[Option[Int]] = Foo.baz should compile but gives
type mismatch;
found : Any
required: List[Option[Int]]
On line 8: error: inferred kinds of the type arguments (AnyVal) do not conform to the expected kinds of the type parameters (type F).
AnyVal's type parameters do not match type F's expected parameters:
class AnyVal has no type parameters, but type F has one
val baz = Baz(l) //infers Baz[Any]
^
On line 8: error: type mismatch;
found : List[Option[Int]]
required: F[Int]
val bur = Baz(l3) //infers Baz[Any] again
^
and Scala 3.3.0-RC3 agrees:
8 | val baz = Baz(l) //infers Baz[Any]
| ^
|Found: (Foo.l : List[Option[Int]])
|Required: F[Int]
|
|where: F is a type variable with constraint <: [_] =>> Any
val l: List[Option[Int]] = Foo.baz
should compile but givespossibly related to #5075 ?
reproduced in 2.12.3
in dotty the error is
repro: https://scastie.scala-lang.org/martijnhoekstra/k9RFNIjCQk2pcI5vvanzow
The text was updated successfully, but these errors were encountered: