diff options
author | Martin Odersky <odersky@gmail.com> | 2017-02-18 13:12:26 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-02-18 14:04:10 +0100 |
commit | 2da43052f0f0ff04c500c074ee429a6d713a6a2d (patch) | |
tree | 50d8790695f3dcc9e43da9f731682d5be3888680 /compiler | |
parent | 1946b36ca4abb7ba8264c18af95bc9c9c94f67ee (diff) | |
download | dotty-2da43052f0f0ff04c500c074ee429a6d713a6a2d.tar.gz dotty-2da43052f0f0ff04c500c074ee429a6d713a6a2d.tar.bz2 dotty-2da43052f0f0ff04c500c074ee429a6d713a6a2d.zip |
Fix off-by-one error in forward reference checking
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 2 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/RefChecks.scala | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 94611e10d..9318ad8c6 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -1055,7 +1055,7 @@ object messages { | |Define `${definition.name}` before it is used, |or move the definition of `${value.name}` so it does not appear between - |the declartion of `${definition.name}` and its use, + |the declaration of `${definition.name}` and its use, |or define `${value.name}` as lazy. |""".stripMargin } diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index eab91701b..7c573d23c 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -789,7 +789,7 @@ class RefChecks extends MiniPhase { thisTransformer => val sym = tree.symbol if (sym.exists && sym.owner.isTerm && !sym.is(Lazy)) currentLevel.levelAndIndex.get(sym) match { - case Some((level, symIdx)) if symIdx < level.maxIndex => + case Some((level, symIdx)) if symIdx <= level.maxIndex => ctx.error(ForwardReferenceExtendsOverDefinition(sym, level.refSym), level.refPos) case _ => } |