Skip to content

Commit 7444ea8

Browse files
authored
Merge pull request scala#10509 from SethTisue/nullary-nilary-crashy-crashy
Don't crash issuing spurious nilary-overrides-nullary warning
2 parents 082a089 + 4c4c88e commit 7444ea8

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ abstract class RefChecks extends Transform {
461461
}
462462
else if (other.paramss.isEmpty && !member.paramss.isEmpty &&
463463
!javaDetermined(member) && !member.overrides.exists(javaDetermined) &&
464-
!member.hasAnnotation(BeanPropertyAttr) && !member.hasAnnotation(BooleanBeanPropertyAttr)
464+
!member.hasAnnotation(BeanPropertyAttr) && !member.hasAnnotation(BooleanBeanPropertyAttr) &&
465+
member.pos.isDefined // scala/bug#12851
465466
) {
466467
val msg = "method with a single empty parameter list overrides method without any parameter list"
467468
val namePos = member.pos.focus.withEnd(member.pos.point + member.decodedName.length)

test/files/pos/t12851/C_2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// scalac: -Werror
2+
class C extends T2

test/files/pos/t12851/T_1.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
trait T1 {
3+
def f: Int
4+
}
5+
trait T2 extends T1 {
6+
def f() = 42
7+
}

0 commit comments

Comments
 (0)