Content-Length: 302371 | pFad | http://github.com/scala/scala/commit/80514f73a6c7db32df9887d9a5ca9ae921e25118

0C Merge pull request #10524 from lrytz/t12858 · scala/scala@80514f7 · GitHub
Skip to content

Commit 80514f7

Browse files
authored
Merge pull request #10524 from lrytz/t12858
Fix spurious "nullary overrides nilary" warning
2 parents f7e30a6 + 96d74ac commit 80514f7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/compiler/scala/tools/nsc/typechecker/RefChecks.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,9 @@ abstract class RefChecks extends Transform {
487487
warnAdaptedNullaryOverride()
488488
}
489489
else if (member.paramLists.isEmpty) {
490-
// NullaryOverrideAdapted is only added to symbols being compiled, so check for a mismatch
491-
// if both symbols are mixed in from the classpath
492-
if (!member.isStable && other.paramLists.nonEmpty && !exempted)
490+
// Definitions that directly override get a parameter list and a `NullaryOverrideAdapted` attachment
491+
// in Namers. Here we also warn when there's a mismatch between two mixed-in members.
492+
if (!member.isStable && other.paramLists.nonEmpty && !exempted && !other.overrides.exists(javaDetermined))
493493
warnAdaptedNullaryOverride()
494494
}
495495
else if (other.paramLists.isEmpty) {

test/files/pos/t12858/A.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
interface A {
2+
int f();
3+
}

test/files/pos/t12858/B.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// scalac: -Werror
2+
3+
trait B1 extends A { def f: Int }
4+
trait C1 { def f = 2 }
5+
class T1 extends B1 with C1
6+
7+
trait B2 extends A { def f: Int = 1}
8+
trait C2 { self: B2 => override def f = 2 }
9+
class T2 extends B2 with C2

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/scala/scala/commit/80514f73a6c7db32df9887d9a5ca9ae921e25118

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy