Skip to content

Simplify forSome types #471

Description

@wiwa

Given:

class Box[A]
trait T
class A extends T
class B extends T
val foo = Seq(new Box[A], new Box[B])

Obtained:

val foo: Seq[Box[_1] forSome {  type _1 >: B with A <: T }] = Seq(new Box[A], new Box[B])

This will occur because Box is invariant.

Expected?:

val foo: Seq[Box[_ <: T]] = Seq(new Box[A], new Box[B])

i.e. we perhaps should expect something like _ <: LeastCommonAncestor. If that is AnyRef, maybe we should only ascribe Box[_].

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions