Skip to content

Commit aa803ed

Browse files
author
Jendrik Wenke
committed
fix off by one error when printing line of previously declared symbol
1 parent aa9ce63 commit aa803ed

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2088,7 +2088,7 @@ object messages {
20882088
case Signature.ParamMatch => "\nOverloads with equal parameter types but different return types are not allowed."
20892089
case Signature.FullMatch => "\nThe definitions have the same signature after erasure."
20902090
}
2091-
hl"${decl.showLocated} is already defined as ${previousSymbol.showDcl} in line ${previousSymbol.pos.line}." + details
2091+
hl"${decl.showLocated} is already defined as ${previousSymbol.showDcl} in line ${previousSymbol.pos.line + 1}." + details
20922092
}
20932093
val explanation = ""
20942094
}

tests/neg/doubleDefinition.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,7 @@ class Test1 {
99

1010

1111
class Test2 {
12-
13-
14-
15-
def foo(
16-
x: List[A]
17-
): Function1[A,
18-
A] =
19-
???
12+
def foo(x: List[A]): Function1[A, A] = ???
2013
def foo(x: List[B]): Function1[B, B] = ??? // error: same jvm signature
2114
// scalac calls this "have same type after erasure"
2215
}

0 commit comments

Comments
 (0)