Closed
Description
1 class Hello {
2 class Foo {
3 class Bar
4 final lazy val s: Bar = ???
5 }
6
7 lazy val foo: Foo = ???
8
9 val x: foo.s.type = ???
10 val x2: foo.s.type = ???
11 }
Expected: both line 9 and 10 produce an error.
Actual: only line 10 produces an error:
10 | val x2: foo.s.type = ???
| ^
| Hello.this.foo.Bar(Hello.this.foo.s) is not a legal path
| since it refers to nonfinal lazy value foo
The reason is the cached and uncached cases are handled differently in https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/core/CheckRealizable.scala#L80
The uncached case doesn't check the prefix (hence why only the second time we try to use the same invalid path errors out).
Metadata
Metadata
Assignees
Labels
No labels