@@ -273,15 +273,6 @@ auto GenericEnvironment::getOrCreateNestedTypeStorage() -> NestedTypeStorage & {
273
273
return *nestedTypeStorage;
274
274
}
275
275
276
- static Type stripBoundDependentMemberTypes (Type t) {
277
- if (auto *depMemTy = t->getAs <DependentMemberType>()) {
278
- return DependentMemberType::get (
279
- stripBoundDependentMemberTypes (depMemTy->getBase ()),
280
- depMemTy->getName ());
281
- }
282
-
283
- return t;
284
- }
285
276
Type
286
277
GenericEnvironment::getOrCreateArchetypeFromInterfaceType (Type depType) {
287
278
auto genericSig = getGenericSignature ();
@@ -315,12 +306,11 @@ GenericEnvironment::getOrCreateArchetypeFromInterfaceType(Type depType) {
315
306
// First, write an ErrorType to the location where this type is cached,
316
307
// to catch re-entrant lookups that might arise from an invalid generic
317
308
// signature (eg, <X where X == Array<X>>).
318
- CanDependentMemberType nestedDependentMemberType ;
309
+ CanDependentMemberType nestedType ;
319
310
GenericTypeParamType *genericParam = nullptr ;
320
311
if (auto depMemTy = requirements.anchor ->getAs <DependentMemberType>()) {
321
- nestedDependentMemberType = cast<DependentMemberType>(
322
- stripBoundDependentMemberTypes (depMemTy)->getCanonicalType ());
323
- auto &entry = getOrCreateNestedTypeStorage ()[nestedDependentMemberType];
312
+ nestedType = cast<DependentMemberType>(depMemTy->getCanonicalType ());
313
+ auto &entry = getOrCreateNestedTypeStorage ()[nestedType];
324
314
if (entry)
325
315
return entry;
326
316
@@ -342,7 +332,9 @@ GenericEnvironment::getOrCreateArchetypeFromInterfaceType(Type depType) {
342
332
343
333
Type result;
344
334
345
- if (requirements.anchor ->getRootGenericParam ()->isTypeSequence ()) {
335
+ auto rootGP = requirements.anchor ->getRootGenericParam ();
336
+ if (rootGP->isTypeSequence ()) {
337
+ assert (getKind () == Kind::Normal);
346
338
result = SequenceArchetypeType::get (ctx, this , requirements.anchor ,
347
339
requirements.protos , superclass,
348
340
requirements.layout );
@@ -384,7 +376,6 @@ GenericEnvironment::getOrCreateArchetypeFromInterfaceType(Type depType) {
384
376
// If the anchor type isn't rooted in a generic parameter that
385
377
// represents an opaque declaration, then apply the outer substitutions.
386
378
// It would be incorrect to build an opaque type archetype here.
387
- auto rootGP = requirements.anchor ->getRootGenericParam ();
388
379
unsigned opaqueDepth =
389
380
getOpaqueTypeDecl ()->getOpaqueGenericParams ().front ()->getDepth ();
390
381
if (rootGP->getDepth () < opaqueDepth) {
@@ -403,7 +394,7 @@ GenericEnvironment::getOrCreateArchetypeFromInterfaceType(Type depType) {
403
394
if (genericParam)
404
395
addMapping (genericParam, result);
405
396
else
406
- getOrCreateNestedTypeStorage ()[nestedDependentMemberType ] = result;
397
+ getOrCreateNestedTypeStorage ()[nestedType ] = result;
407
398
408
399
return result;
409
400
}
0 commit comments