I agree it's ugly. The main problem is that Type::buildTypeInfo is usually called with the scope of the expression to evaluate, not the type. That would mean we'll have to save the scope in every struct/class/interface type.