mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Eliminate some pointless uses of the doomed DeclContext::getSelfTypeInContext()
This commit is contained in:
@@ -1331,13 +1331,7 @@ void TypeChecker::completePropertyBehaviorParameter(VarDecl *VD,
|
||||
// Borrow the parameters from the requirement declaration.
|
||||
SmallVector<ParameterList *, 2> ParamLists;
|
||||
if (DC->isTypeContext()) {
|
||||
auto self = new (Context) ParamDecl(/*let*/ true, SourceLoc(), SourceLoc(),
|
||||
Identifier(), SourceLoc(),
|
||||
Context.Id_self,
|
||||
DC->getSelfTypeInContext(), DC);
|
||||
self->setInterfaceType(DC->getSelfInterfaceType());
|
||||
self->setImplicit();
|
||||
|
||||
auto self = ParamDecl::createSelf(SourceLoc(), DC);
|
||||
ParamLists.push_back(ParameterList::create(Context, SourceLoc(),
|
||||
self, SourceLoc()));
|
||||
ParamLists.back()->get(0)->setImplicit();
|
||||
|
||||
@@ -4616,6 +4616,7 @@ public:
|
||||
if (!selfNominal) return;
|
||||
|
||||
// Check the parameters for a reference to 'Self'.
|
||||
auto genericEnv = FD->getGenericEnvironment();
|
||||
bool isProtocol = isa<ProtocolDecl>(selfNominal);
|
||||
for (auto param : *FD->getParameterList(1)) {
|
||||
auto paramType = param->getType();
|
||||
@@ -4623,7 +4624,10 @@ public:
|
||||
|
||||
// Look through 'inout'.
|
||||
paramType = paramType->getInOutObjectType();
|
||||
|
||||
if (genericEnv) {
|
||||
paramType = genericEnv->mapTypeOutOfContext(FD->getModuleContext(),
|
||||
paramType);
|
||||
}
|
||||
// Look through a metatype reference, if there is one.
|
||||
if (auto metatypeType = paramType->getAs<AnyMetatypeType>())
|
||||
paramType = metatypeType->getInstanceType();
|
||||
@@ -4636,11 +4640,6 @@ public:
|
||||
if (auto genericParam = paramType->getAs<GenericTypeParamType>())
|
||||
if (genericParam->isEqual(DC->getSelfInterfaceType()))
|
||||
return;
|
||||
|
||||
// ... or the 'Self' archetype?
|
||||
if (auto archetype = paramType->getAs<ArchetypeType>())
|
||||
if (archetype->isEqual(DC->getSelfTypeInContext()))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2392,7 +2392,7 @@ static void diagnoseNoWitness(ValueDecl *Requirement, Type RequirementType,
|
||||
Options.AccessibilityFilter = Accessibility::Private;
|
||||
Options.PrintAccessibility = false;
|
||||
Options.FunctionBody = [](const ValueDecl *VD) { return "<#code#>"; };
|
||||
Options.setBaseType(Adopter->getSelfTypeInContext());
|
||||
Options.setBaseType(Conformance->getType());
|
||||
Options.CurrentModule = Adopter->getParentModule();
|
||||
if (!Adopter->isExtensionContext()) {
|
||||
// Create a variable declaration instead of a computed property in
|
||||
|
||||
@@ -942,7 +942,7 @@ resolveTopLevelIdentTypeComponent(TypeChecker &TC, DeclContext *DC,
|
||||
// while the 'Self' type is more than just a reference to a TypeDecl.
|
||||
|
||||
return DynamicSelfType::get(
|
||||
func->getDeclContext()->getSelfTypeInContext(),
|
||||
func->computeSelfType()->getRValueInstanceType(),
|
||||
TC.Context);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user