[swift-dev] Allowing extensions of bound generic types
jtbandes at gmail.com
Sun Dec 13 01:33:21 CST 2015
Hi Doug, thanks for the response!
There’s a path through TypeChecker::handleSILGenericParams() that you need
> to consider, which is triggered when parsing SIL. It’s an odd case because
> you get all of the generic parameter lists up front. I suspect you would
> just always allow type parameters to be equated with concrete types from
Yeah, sounds reasonable.
You may need to make the AllowConcreteRequirements flag indicate the depth
> at which generic parameters are allowed to be made equivalent to concrete
I guess that makes sense to me, although I'm not convinced it's actually
going to be necessary. I'm going to try to get an initial version working
first, then consider using depth instead of just a bool.
The problem I'm running into now is that the PotentialArchetype's
getType(ArchetypeBuilder&) is returning the concrete type it was
constrained to, so castToArchetype fails (inside getAllArchetypes, during
finalizeGenericParamList). I tried simply skipping these archetypes, but a
lot of stuff downstream seems to depend on the number of archetypes
matching the number of generic params (such as
ConsraintSystem::openGeneric, BoundGenericType, etc.). Do you think I
should be modifying ArchetypeBuilder::PotentialArchetype::getType() to
return a valid archetype in this case, and just let the constraint solver
deal with the same-type requirement later on?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev