Commits

Jordan Rose committed 2c4c7bd1525
Don't serialize full ConcreteDeclRefs for conformance value witnesses. A protocol conformance needs to know what declarations satisfy requirements; these are called "witnesses". For a value (non-type) witness, this takes the form of a ConcreteDeclRef, i.e. a ValueDecl plus any generic specialization. (Think Array<Int> rather than Array<T>, but for a function.) This information is necessary to compile the conformance, but it causes problems when the conformance is used from other modules. In particular, the type used in a specialization might itself be a generic type in the form of an ArchetypeType. ArchetypeTypes can't be meaningfully used outside their original context, however, so this is a weird thing to have to deal with. (I'm not going to go into when a generic parameter is represented by an ArchetypeType vs. a GenericTypeParamType, partially because I don't think I can explain it well myself.) The above issue becomes a problem when we go to use the conformance from another module. If module C uses a conformance from module B that has a generic witness from module A, it'll think that the archetypes in the specialization for the witness belong in module B. Which is just wrong. It turns out, however, that no code is using the full specializations for witnesses except for when the conformance is being compiled and emitted. So this commit sidesteps the problem by just not serializing the specializations that go with the ConcreteDeclRef for a value witness. This doesn't fix the underlying issue, so we should probably still see if we can either get archetypes from other contexts out of value witness ConcreteDeclRefs, or come up with reasonable rules for when they're okay to use. rdar://problem/23892955