Skip to content

Commit cd74b12

Browse files
smarterfelixmulder
authored andcommitted
Fix position used in variance error message
1 parent 76c3ae3 commit cd74b12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ class VarianceChecker()(implicit ctx: Context) {
112112
case Some(VarianceError(tvar, required)) =>
113113
def msg = i"${varianceString(tvar.flags)} $tvar occurs in ${varianceString(required)} position in type ${sym.info} of $sym"
114114
if (ctx.scala2Mode && sym.owner.isConstructor) {
115-
ctx.migrationWarning(s"According to new variance rules, this is no longer accepted; need to annotate with @uncheckedVariance:\n$msg", sym.pos)
115+
ctx.migrationWarning(s"According to new variance rules, this is no longer accepted; need to annotate with @uncheckedVariance:\n$msg", pos)
116116
patch(Position(pos.end), " @scala.annotation.unchecked.uncheckedVariance") // TODO use an import or shorten if possible
117117
}
118-
else ctx.error(msg, sym.pos)
118+
else ctx.error(msg, pos)
119119
case None =>
120120
}
121121

0 commit comments

Comments
 (0)