Open
Description
Compiler version
3.7.0-RC1
Minimized code
type A = Record {val a: Int}
type B = Record {val b: String}
type AB = A & B
// from https://docs.scala-lang.org/scala3/reference/changed-features/structural-types.html
class Record(elems: (String, Any)*) extends Selectable:
private val fields = elems.toMap
def selectDynamic(name: String): Any = fields(name)
val a: A = Record("a" -> 1).asInstanceOf[A]
val a_a = a.a
// ^ hover here (val a: Int)
val ab: AB = Record("a" -> 1, "b" -> "hello").asInstanceOf[AB]
val ab_a = ab.a
// ^ hover here (nothing)
Output
- for
a
, the hover showsval a: Int
- for
ab
, it shows nothing
Expectation
I'd expect to see a: Int
when hovering, as merging two types into a new type is a common operation in structurally typed language (e.g typescript).
