Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit80514f7

Browse files
authored
Merge pull request#10524 from lrytz/t12858
Fix spurious "nullary overrides nilary" warning
2 parentsf7e30a6 +96d74ac commit80514f7

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
elseif (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
elseif (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+
interfaceA {
2+
intf();
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+
traitB1extendsA {deff:Int }
4+
traitC1 {deff=2 }
5+
classT1extendsB1withC1
6+
7+
traitB2extendsA {deff:Int=1}
8+
traitC2 {self:B2=>overridedeff=2 }
9+
classT2extendsB2withC2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp