diff options
author | odersky <odersky@gmail.com> | 2017-02-22 11:33:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-22 11:33:52 +0100 |
commit | 5c7ef22a5464456a3e95869c0f6154a2ae8a5f84 (patch) | |
tree | b65e67507ca53f2c1c51bf4f85f67620ffc7aa69 /compiler | |
parent | 355232690d96e458764159a66f3fed0135c059a3 (diff) | |
parent | 815e426c8512e046f09edb7c7d3c3a98653bce24 (diff) | |
download | dotty-5c7ef22a5464456a3e95869c0f6154a2ae8a5f84.tar.gz dotty-5c7ef22a5464456a3e95869c0f6154a2ae8a5f84.tar.bz2 dotty-5c7ef22a5464456a3e95869c0f6154a2ae8a5f84.zip |
Merge pull request #1997 from dotty-staging/fix-#1992
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 7fccebef9..e818e7a42 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -1062,7 +1062,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 _ => } |