Open scabug opened 9 years ago
Imported From: https://issues.scala-lang.org/browse/SI-9163?orig=1 Reporter: @soc Affected Versions: 2.11.5
@som-snytt said:
scala> new { object b }
res0: AnyRef{object b} = $anon$1@22b48b21
scala> res0.b
warning: there was one feature warning; re-run with -feature for details
java.lang.AssertionError: assertion failed: unsafe symbol $anon$1 (child of object $iw) in runtime reflection universe
@paulp said:
// That isn't even a type.
AnyRef { object b }
// It should infer this.
AnyRef { val b: AnyRef }
FWIW this doesn't crash in 2.13.0-M3, but it still infers the invalid (?) type A { object b }
.
Also this, if that turns out to be valid somehow:
scala> (new { object b }) : (AnyRef { val b: Any })
<console>:37: error: type mismatch;
found : AnyRef{object b}
required: AnyRef{val b: Any}
(new { object b }) : (AnyRef { val b: Any })
^
Reported by Jerzy Müller: https://groups.google.com/d/topic/scala-internals/fSFBe9ebiqw/discussion
It works on 2.10.4.