Skip to content

Spurious, positionless overrides-nullary-method warning when extending under separate compilation #12851

Closed
scala/scala
#10509
@SethTisue

Description

@SethTisue

Scala version: 2.13.11

T.scala

trait T1 {
  def method: Int
}
trait T2 extends T1 {
  def method() = 0
}

C.scala

class C extends T2

Reproduction steps

scalac T.scala
scalac -classpath . C.scala

Result

compiling T.scala produces a correct warning:

T.scala:5: warning: method with a single empty parameter list overrides method without any parameter list
  def method() = 0
      ^
1 warning

but then compiling C.scala produces this:

warning: method with a single empty parameter list overrides method without any parameter list
1 warning

we shouldn't be issuing this warning at all IMO, but also note the lack of position information, which means it's difficult to figure out where it's even coming from

Context

This came up over at scala/scala#10484 , where after a recent change for 2.13.12 the attempt to issue the warning actually crashes the compiler.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions