This code path is there to support some legacy behaviors that were part of the GenericSignatureBuilder, but are now just modeled in an approximate way. Consider these two functions:
class C {
struct A {}
}
func f<T: C>(_: T, _: T.A) {}
protocol P {}
extension P {
typealias A = Int
}
func g<T: P>(_: T, _: T.A) {}
The T.A in each case refers to a concrete member type, and not an associated type. They are resolved in interface type resolution, and we don't actually form a DependentMemberType in this case. We ought to be able to support module selectors here, so you could write T.Mod::A.
The hack you saw comes in if you reference a concrete type member of a type parameter from a where clause. In the general case, T.A in a where clause can only refer to an associated type declaration named A. However, there is a hack in swift/lib/AST/RequirementMachine/ConcreteContraction.cpp at main ¡ swiftlang/swift ¡ GitHub to allow some things like this to work:
class C {
struct A {}
}
func f<T: C, U: Sequence>(_: T, _: U) where U.Element == T.A {}
Here, we start with a DependentMemberType T.A, but we fold it down to a concrete type in concrete contraction.
In the first case, you could allow module selectors to appear if you think it's worth it -- interface type resolution doesn't form DependentMemberTypes unless name lookup returns an associated type declaration.
When we're resolving the where clause though, we don't have enough information to do name lookups, so we just form structural DependentMemberTypes. I don't think it's worth trying to hack module selectors into DependentMemberType, we should just say module selectors cannot be used with a type parameter base in a where clause.
(If we were doing this all over again, the first behavior of member types in interface type resolution might be defensible, but the thing that concrete contraction models should not exist at all.)