File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1055,7 +1055,7 @@ object messages {
1055
1055
|
1056
1056
|Define ` ${definition.name}` before it is used,
1057
1057
|or move the definition of ` ${value.name}` so it does not appear between
1058
- |the declartion of ` ${definition.name}` and its use,
1058
+ |the declaration of ` ${definition.name}` and its use,
1059
1059
|or define ` ${value.name}` as lazy.
1060
1060
| """ .stripMargin
1061
1061
}
Original file line number Diff line number Diff line change @@ -789,7 +789,7 @@ class RefChecks extends MiniPhase { thisTransformer =>
789
789
val sym = tree.symbol
790
790
if (sym.exists && sym.owner.isTerm && ! sym.is(Lazy ))
791
791
currentLevel.levelAndIndex.get(sym) match {
792
- case Some ((level, symIdx)) if symIdx < level.maxIndex =>
792
+ case Some ((level, symIdx)) if symIdx <= level.maxIndex =>
793
793
ctx.error(ForwardReferenceExtendsOverDefinition (sym, level.refSym), level.refPos)
794
794
case _ =>
795
795
}
Original file line number Diff line number Diff line change
1
+ object Test {
2
+ def main (args : Array [String ]) = {
3
+ val x : Int => Unit =
4
+ y => println(x) // error: `x` is a forward reference
5
+ implicit val z : String => Unit =
6
+ y => println(implicitly[String => Unit ]) // error: `z` is a forward reference
7
+ }
8
+ }
9
+
You can’t perform that action at this time.
0 commit comments