@@ -419,16 +419,15 @@ TypeChecker::getDynamicBridgedThroughObjCClass(DeclContext *dc,
419419 return dc->getASTContext ().getBridgedToObjC (dc, valueType);
420420}
421421
422- Type TypeChecker ::resolveTypeInContext (TypeDecl *typeDecl, DeclContext *foundDC ,
423- TypeResolution resolution ,
424- bool isSpecialized) {
425- auto fromDC = resolution. getDeclContext ();
422+ Type TypeResolution ::resolveTypeInContext (TypeDecl *typeDecl,
423+ DeclContext *foundDC ,
424+ bool isSpecialized) {
425+ auto fromDC = getDeclContext ();
426426 ASTContext &ctx = fromDC->getASTContext ();
427427
428428 // If we found a generic parameter, map to the archetype if there is one.
429429 if (auto genericParam = dyn_cast<GenericTypeParamDecl>(typeDecl)) {
430- return resolution.mapTypeIntoContext (
431- genericParam->getDeclaredInterfaceType ());
430+ return mapTypeIntoContext (genericParam->getDeclaredInterfaceType ());
432431 }
433432
434433 if (!isSpecialized) {
@@ -440,13 +439,12 @@ Type TypeChecker::resolveTypeInContext(TypeDecl *typeDecl, DeclContext *foundDC,
440439 parentDC = parentDC->getParent ()) {
441440 auto *parentNominal = parentDC->getSelfNominalTypeDecl ();
442441 if (parentNominal == nominalType)
443- return resolution.mapTypeIntoContext (
444- parentDC->getDeclaredInterfaceType ());
442+ return mapTypeIntoContext (parentDC->getDeclaredInterfaceType ());
445443 if (isa<ExtensionDecl>(parentDC)) {
446444 auto *extendedType = parentNominal;
447445 while (extendedType != nullptr ) {
448446 if (extendedType == nominalType)
449- return resolution. mapTypeIntoContext (
447+ return mapTypeIntoContext (
450448 extendedType->getDeclaredInterfaceType ());
451449 extendedType = extendedType->getParent ()->getSelfNominalTypeDecl ();
452450 }
@@ -466,11 +464,11 @@ Type TypeChecker::resolveTypeInContext(TypeDecl *typeDecl, DeclContext *foundDC,
466464 if (auto *ugAliasDecl =
467465 dyn_cast<TypeAliasDecl>(unboundGeneric->getAnyGeneric ())) {
468466 if (ugAliasDecl == aliasDecl) {
469- if (resolution. getStage () == TypeResolutionStage::Structural &&
467+ if (getStage () == TypeResolutionStage::Structural &&
470468 aliasDecl->getUnderlyingTypeRepr () != nullptr ) {
471469 return aliasDecl->getStructuralType ();
472470 }
473- return resolution. mapTypeIntoContext (
471+ return mapTypeIntoContext (
474472 aliasDecl->getDeclaredInterfaceType ());
475473 }
476474
@@ -481,12 +479,11 @@ Type TypeChecker::resolveTypeInContext(TypeDecl *typeDecl, DeclContext *foundDC,
481479 if (auto *aliasType =
482480 dyn_cast<TypeAliasType>(extendedType.getPointer ())) {
483481 if (aliasType->getDecl () == aliasDecl) {
484- if (resolution. getStage () == TypeResolutionStage::Structural &&
482+ if (getStage () == TypeResolutionStage::Structural &&
485483 aliasDecl->getUnderlyingTypeRepr () != nullptr ) {
486484 return aliasDecl->getStructuralType ();
487485 }
488- return resolution.mapTypeIntoContext (
489- aliasDecl->getDeclaredInterfaceType ());
486+ return mapTypeIntoContext (aliasDecl->getDeclaredInterfaceType ());
490487 }
491488 extendedType = aliasType->getParent ();
492489 continue ;
@@ -507,12 +504,11 @@ Type TypeChecker::resolveTypeInContext(TypeDecl *typeDecl, DeclContext *foundDC,
507504 return aliasDecl->getUnboundGenericType ();
508505
509506 // Otherwise, return the appropriate type.
510- if (resolution. getStage () == TypeResolutionStage::Structural &&
507+ if (getStage () == TypeResolutionStage::Structural &&
511508 aliasDecl->getUnderlyingTypeRepr () != nullptr ) {
512509 return aliasDecl->getStructuralType ();
513510 }
514- return resolution.mapTypeIntoContext (
515- aliasDecl->getDeclaredInterfaceType ());
511+ return mapTypeIntoContext (aliasDecl->getDeclaredInterfaceType ());
516512 }
517513
518514 // When a nominal type used outside its context, return the unbound
@@ -539,12 +535,11 @@ Type TypeChecker::resolveTypeInContext(TypeDecl *typeDecl, DeclContext *foundDC,
539535 if (!foundDC->getDeclaredInterfaceType ())
540536 return ErrorType::get (ctx);
541537
542- selfType =
543- resolution.mapTypeIntoContext (foundDC->getDeclaredInterfaceType ());
538+ selfType = mapTypeIntoContext (foundDC->getDeclaredInterfaceType ());
544539 } else {
545540 // Otherwise, we want the protocol 'Self' type for
546541 // substituting into alias types and associated types.
547- selfType = resolution. mapTypeIntoContext (foundDC->getSelfInterfaceType ());
542+ selfType = mapTypeIntoContext (foundDC->getSelfInterfaceType ());
548543
549544 if (selfType->is <GenericTypeParamType>()) {
550545 if (typeDecl->getDeclContext ()->getSelfProtocolDecl ()) {
@@ -559,9 +554,9 @@ Type TypeChecker::resolveTypeInContext(TypeDecl *typeDecl, DeclContext *foundDC,
559554 // because we use the Sequence.SubSequence default instead of
560555 // the Collection.SubSequence default, even when the conforming
561556 // type wants to conform to Collection.
562- if (resolution. getStage () == TypeResolutionStage::Structural) {
563- return resolution. resolveSelfAssociatedType (selfType, foundDC,
564- typeDecl->getName ());
557+ if (getStage () == TypeResolutionStage::Structural) {
558+ return resolveSelfAssociatedType (selfType, foundDC,
559+ typeDecl->getName ());
565560 } else if (auto assocType = dyn_cast<AssociatedTypeDecl>(typeDecl)) {
566561 typeDecl = assocType->getAssociatedTypeAnchor ();
567562 }
@@ -587,8 +582,8 @@ Type TypeChecker::resolveTypeInContext(TypeDecl *typeDecl, DeclContext *foundDC,
587582 }
588583
589584 // Finally, substitute the base type into the member type.
590- return substMemberTypeWithBase (fromDC-> getParentModule (), typeDecl, selfType,
591- resolution. usesArchetypes ());
585+ return TypeChecker:: substMemberTypeWithBase (
586+ fromDC-> getParentModule (), typeDecl, selfType, usesArchetypes ());
592587}
593588
594589static TypeResolutionOptions
@@ -1071,8 +1066,8 @@ static Type resolveTypeDecl(TypeDecl *typeDecl, DeclContext *foundDC,
10711066 ComponentIdentTypeRepr *comp) {
10721067 // Resolve the type declaration to a specific type. How this occurs
10731068 // depends on the current context and where the type was found.
1074- Type type = TypeChecker:: resolveTypeInContext (
1075- typeDecl, foundDC, resolution, isa<GenericIdentTypeRepr>(comp));
1069+ Type type = resolution. resolveTypeInContext (typeDecl, foundDC,
1070+ isa<GenericIdentTypeRepr>(comp));
10761071
10771072 if (type->hasError () && foundDC &&
10781073 (isa<AssociatedTypeDecl>(typeDecl) || isa<TypeAliasDecl>(typeDecl))) {
0 commit comments