-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
backlogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.itype:bug
Description
Compiler version
3.0.0-M3
Minimized code
class A
class B extends A
object O {
opaque type Id[T] = T
extension[T](id: Id[T]) def get: T = id
def f[S <: A, T](ff: S => T): Id[S => T] = ???
def g[S <: A, T](ff: S => T): Option[S => T] = ???
def h[S, T](ff: S => T): Id[S => T] = ???
}
import O._
val a = new A
val b = new B
val f1/*: O.Id[Nothing => Int]*/ = f((a: A) => 0)
f1.get.apply(a) //ERROR: Found: (a : A) Required: Nothing
val f2 = f((b: B) => 0)
f2.get.apply(b) //OK: works with B, the proper subtype of A
val g1 = g((a: A) => 0)
g1.get.apply(a) //OK: works without using opaque type
val h1 = h((a: A) => 0)
h1.get.apply(a) //OK: works without type bound
Metadata
Metadata
Assignees
Labels
backlogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.itype:bug