Deserialize generic contexts by mapping their archetypes

to the archetypes of their generic parameter declarations.

This was a major inconsistency that was causing a lot of
problems with deserialized generic functions in the presence
of chained module files.  In particular, what would happen is
that all the deserialized uses of the archetype would be
mapped to a freshly-created archetype, but the GenericParamList
would refer to GenericTypeParamDecls deserialized from
(potentially) a different ModuleFile and therefore using a
different archetype (since the deserializer assumes that
different modules never share archetypes).

The fix relies on processing a generic parameter list before
any references to the archetypes.  Unfortunately, we have
bogus references to archetypes in substitution lists scattered
everywhere in SIL and the AST.  I've introduced a really
gross hack where we allow archetypes to be created in that
way but just drop them (in favor of the parameter's archetype)
after processing the generic parameter list; this should
work as long as all the decontextualized references are
basically pointless, but like I said, it's gross, and I've
filed rdar://16240384 to clean it up.

Swift SVN r14694
This commit is contained in:
John McCall
2014-03-05 22:41:28 +00:00
parent 69855ba446
commit a8ed3dae12
2 changed files with 57 additions and 7 deletions

View File

@@ -133,6 +133,10 @@ public:
Value = deserialized;
return *this;
}
void unsafeOverwrite(T t) {
Value = t;
}
};
/// A class for holding a value that can be partially deserialized.