Commits

Doug Gregor committed fea55d98f26
Eliminate dependent types from within archetypes. When dealing with multiple levels of generic parameters, the mapping from potential archetypes down to actual archetypes did not have access to the archetypes for outer generic parameters. When same-type requirements equated a type from the inner generic parameter list with one from the outer generic parameter list, the reference to the outer generic parameter list's type would remain dependent. For example, given: struct S<A: P> { init<Q: P where Q.T == A>(_ q: Q) {} } we would end up with the dependent type for A (τ_0_0) in the same-type constraint in the initializer requirement. Now, notify the ArchetypeBuilder of outer generic signatures (and, therefore, outer generic parameters), so that it has knowledge of the mapping from those generic parameters to the corresponding archetypes. Use that mapping when translating potential archetypes to real archetypes. Additionally, when a potential archetype is mapped to a concrete type (via a same-type constraint to a concrete type), substitute archetypes for any dependent types within the concrete type. Remove a bunch of hacks in the compiler that identified dependent types in "strange" places and tried to map them back to archetypes. Those hacks handled some narrow cases we saw in the standard library and some external code, but papered over the underlying issue and left major gaps. Sadly, introduce one hack into the type checker to help with the matching of generic witnesses to generic requirements that follow the pattern described above. See ConstraintSystem::SelfTypeVar; the proper implementation for this matching involves substituting the adoptee type in for Self within the requirement, and synthesizing new archetypes from the result. Fixes rdar://18435371, rdar://18803556, rdar://19082500, rdar://19245317, rdar://19371678 and a half dozen compiler crashers from the crash suite. There are a few other radars that I suspect this fixes, but which require more steps to reproduce. Swift SVN r24460