mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Move mapType{In,OutOf}Context() out of ArchetypeBuilder and clean up headers
- The DeclContext versions of these methods have equivalents on the DeclContext class; use them instead. - The GenericEnvironment versions of these methods are now static methods on the GenericEnvironment class. Note that these are not made redundant by the instance methods on GenericEnvironment, since the static methods can also be called with a null GenericEnvironment, in which case they just assert that the type is fully concrete. - Remove some unnecessary #includes of ArchetypeBuilder.h and GenericEnvironment.h. Now changes to these files result in a lot less recompilation.
This commit is contained in:
@@ -1313,12 +1313,12 @@ bool swift::fixItOverrideDeclarationTypes(InFlightDiagnostic &diag,
|
||||
});
|
||||
}
|
||||
if (auto *method = dyn_cast<FuncDecl>(decl)) {
|
||||
auto resultType = ArchetypeBuilder::mapTypeIntoContext(
|
||||
method, method->getResultInterfaceType());
|
||||
auto resultType = method->mapTypeIntoContext(
|
||||
method->getResultInterfaceType());
|
||||
|
||||
auto *baseMethod = cast<FuncDecl>(base);
|
||||
auto baseResultType = ArchetypeBuilder::mapTypeIntoContext(
|
||||
baseMethod, baseMethod->getResultInterfaceType());
|
||||
auto baseResultType = baseMethod->mapTypeIntoContext(
|
||||
baseMethod->getResultInterfaceType());
|
||||
|
||||
fixedAny |= checkType(resultType, baseResultType,
|
||||
method->getBodyResultTypeLoc().getSourceRange());
|
||||
@@ -1335,11 +1335,9 @@ bool swift::fixItOverrideDeclarationTypes(InFlightDiagnostic &diag,
|
||||
fixedAny |= fixItOverrideDeclarationTypes(diag, param, baseParam);
|
||||
});
|
||||
|
||||
auto resultType = ArchetypeBuilder::mapTypeIntoContext(
|
||||
subscript->getDeclContext(),
|
||||
auto resultType = subscript->getDeclContext()->mapTypeIntoContext(
|
||||
subscript->getElementInterfaceType());
|
||||
auto baseResultType = ArchetypeBuilder::mapTypeIntoContext(
|
||||
baseSubscript->getDeclContext(),
|
||||
auto baseResultType = baseSubscript->getDeclContext()->mapTypeIntoContext(
|
||||
baseSubscript->getElementInterfaceType());
|
||||
fixedAny |= checkType(resultType, baseResultType,
|
||||
subscript->getElementTypeLoc().getSourceRange());
|
||||
@@ -4051,7 +4049,7 @@ Optional<DeclName> TypeChecker::omitNeedlessWords(AbstractFunctionDecl *afd) {
|
||||
|
||||
if (auto func = dyn_cast<FuncDecl>(afd)) {
|
||||
resultType = func->getResultInterfaceType();
|
||||
resultType = ArchetypeBuilder::mapTypeIntoContext(func, resultType);
|
||||
resultType = func->mapTypeIntoContext(resultType);
|
||||
returnsSelf = func->hasDynamicSelf();
|
||||
} else if (isa<ConstructorDecl>(afd)) {
|
||||
resultType = contextType;
|
||||
|
||||
Reference in New Issue
Block a user