Skip to content

Weird Scala 2.13 Error: illegal trait super target found for method #12520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cheeseng opened this issue Jan 8, 2022 · 0 comments · Fixed by scala/scala#9901
Closed

Weird Scala 2.13 Error: illegal trait super target found for method #12520

cheeseng opened this issue Jan 8, 2022 · 0 comments · Fixed by scala/scala#9901
Assignees
Milestone

Comments

@cheeseng
Copy link

cheeseng commented Jan 8, 2022

reproduction steps

using Scala 2.13.7,

class Outcome
trait TestSuite { thisTestSuite =>
  protected trait NoArgTest extends (() => Outcome)
  protected def withFixture(test: NoArgTest): Outcome = {
    test()
  }
}
trait TestSuiteMixin { this: TestSuite =>
  protected def withFixture(test: NoArgTest): Outcome
}
trait TimeLimitedTests extends TestSuiteMixin { this: TestSuite =>
  abstract override def withFixture(test: NoArgTest): Outcome = super.withFixture(test)
}
trait AnyFunSuiteLike extends TestSuite { thisSuite => }
abstract class Test[C] extends AnyFunSuiteLike with TimeLimitedTests

problem

It got the following compiler error when compiles with Scala 2.13:

cheeseng@cheeseng-RAVEN:~/git/213-bug$ scalac Test.scala
Test.scala:15: error: illegal trait super target found for method withFixture required by trait TimeLimitedTests;
 found   : protected def withFixture: ((test: _1.NoArgTest): Outcome) forSome { val _1: [C]Test[C] } in trait TestSuite;
 expected: protected def withFixture: ((test: _1.NoArgTest): Outcome) forSome { val _1: [C]Test[C] } in trait TestSuiteMixin
abstract class Test[C] extends AnyFunSuiteLike with TimeLimitedTests

The same code compiles fine with Scala 3 and 2.12.

This is originally reported as ScalaTest issue here: scalatest/scalatest#2088

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants