Skip to content

GADT issue #5418

Closed
Closed
@allanrenucci

Description

@allanrenucci

Found in the 2.13 std lib:

class Test {
  class Tree[A]
  class TreeSet[A](tree: Tree[A])

  def fromOrderedKeys[A](xs: Iterator[A]): Tree[A] = ???

  def from[E](it: Iterable[E]): TreeSet[E] =
    it match {
      case r: Range =>
        val it = r.iterator
        new TreeSet[E](fromOrderedKeys(it))
    }
}
-- [E007] Type Mismatch Error: Test.scala:11:39 --------------------
11 |        new TreeSet[E](fromOrderedKeys(it))
   |                                       ^^
   |                                       found:    Iterator[Int](it)
   |                                       required: Iterator[E]
   |                                       
one error found

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions