Type of an anonymous class derivation

Huh, I didn’t realize this behavior had changed. Works fine in Scala 2. It surprises me that this didn’t break things. It doesn’t even work if you ascribe the refinement.

scala> val x = new { val r = 0 } : AnyRef { val r: Int }                                      
val x: AnyRef{r: Int} = anon$1@56554e7

scala> x.r
1 |x.r
  |^^^
  |value r is not a member of x
2 Likes