Skip to content

AbstractMethodError when abstract override method implement in self type #8582

Closed
@ohze

Description

@ohze

minimized code

trait Suite {
  def run() = println("Suite")
}
trait SuiteMixin { this: Suite =>
  def run(): Unit
}
trait BeforeAndAfterAll extends SuiteMixin { this: Suite =>
  abstract override def run() = super.run()
}
class MySpec extends Suite with BeforeAndAfterAll
object Main {
  def main(args: Array[String]): Unit = {
    new MySpec().run()
  }
}

Runtime output

[info] running Main 
[error] (run-main-1e) java.lang.AbstractMethodError: 'void SuiteMixin.run()'
[error] java.lang.AbstractMethodError: 'void SuiteMixin.run()'
[error] 	at MySpec.BeforeAndAfterAll$$super$run(Main.scala:10)
[error] 	at BeforeAndAfterAll.run(Main.scala:8)
[error] 	at MySpec.run(Main.scala:10)
[error] 	at Main$.main(Main.scala:13)

expectation

print Suite as in scala 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions