Skip to content
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

Missing arity warnings in unrelated super traits #12853

Open
som-snytt opened this issue Aug 28, 2023 · 0 comments
Open

Missing arity warnings in unrelated super traits #12853

som-snytt opened this issue Aug 28, 2023 · 0 comments

Comments

@som-snytt
Copy link

Reproduction steps

Scala version: 2.13.12

➜  scala git:(issue/12851-namepos) cat test/files/neg/t12851b/T_1.scala

trait T1 {
  def f: Int
  def g(): Int
}
trait T2 {
  def f() = 42
  def g = 42
}
➜  scala git:(issue/12851-namepos) cat test/files/neg/t12851b/C_2.scala
// scalac: -Werror
class C extends T1 with T2

Problem

➜  scala git:(issue/12851-namepos) scalac -d /tmp -cp /tmp test/files/neg/t12851b/C_2.scala
warning: method with a single empty parameter list overrides method without any parameter list
1 warning
➜  scala git:(issue/12851-namepos) scalac -d /tmp test/files/neg/t12851b/*.scala
test/files/neg/t12851b/T_1.scala:8: warning: method with a single empty parameter list overrides method without any parameter list
  def f() = 42
      ^
1 warning

should offer both warnings, whether compiled together or separately:

➜  scala git:(issue/12851-namepos) skalac -d /tmp -cp /tmp test/files/neg/t12851b/C_2.scala
test/files/neg/t12851b/C_2.scala:2: warning: method (method f in trait T2) with a single empty parameter list overrides method without any parameter list
class C extends T1 with T2
      ^
test/files/neg/t12851b/C_2.scala:2: warning: method (method g in trait T2) without a parameter list overrides a method with a single empty one
class C extends T1 with T2
      ^
2 warnings
➜  scala git:(issue/12851-namepos) skalac -d /tmp test/files/neg/t12851b/*.scala
test/files/neg/t12851b/C_2.scala:2: warning: method (method f in trait T2) with a single empty parameter list overrides method without any parameter list
class C extends T1 with T2
      ^
test/files/neg/t12851b/C_2.scala:2: warning: method (method g in trait T2) without a parameter list overrides a method with a single empty one
class C extends T1 with T2
      ^
2 warnings

Noticed at #12851

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

Successfully merging a pull request may close this issue.

2 participants