Skip to content

Compat Scala 2: Abstract override #4770

@allanrenucci

Description

@allanrenucci
class Seq

trait IterableOnceOps {
  def toSeq: Seq = new Seq
}

trait IterableOps extends IterableOnceOps

trait SeqOps extends IterableOps {
  def toSeq: Seq
}

class Foo extends SeqOps

The code snippet above compiles with Scala2 but not Dotty:

-- Error: tests/allan/Test.scala:53:6 ------------------------------------------
53 |class Foo extends SeqOps
   |      ^
   | class Foo needs to be abstract, since def toSeq: => Seq is not defined 
one error found

This pattern is used in the 2.13 collection library

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