Annoying, but scala's immutable Map is not covariant in its first argument the way one would normally expect a collection to be.
Annoying, but scala's immutable Map is not covariant in its first argument the way one would normally expect a collection to be.
So Map[StepQName, ElementRuntimeData] is not a subtype of Map[QNameBase, ElementRuntimeData] which means when we construct a Map using the NamedQName of the elements, we can't use that with StepQNames as the query items. But QName comparisons are carefully strongly typed to prevent you from comparing the wrong kinds. For example, you can check if a StepQName matches a NamedQName, but you can't compare two NamedQNames together (because, generally, that would be a mistake.)
So we need a cast upward to QNameBase
Schema compiler computes the map here, and then attaches this object to the ERD of each element.