Skip to content

Commit e8004b7

Browse files
authored
Merge pull request #85459 from slavapestov/rename-generic-environment-operations
AST: Rename mapTypeIntoContext() => mapTypeIntoEnvironment(), mapTypeOutOfContext() => mapTypeOutOfEnvironment()
2 parents a96b57d + 64f2d1a commit e8004b7

File tree

182 files changed

+694
-694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+694
-694
lines changed

SwiftCompilerSources/Sources/AST/GenericSignature.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public struct GenericSignature: CustomStringConvertible, NoReflectionChildren {
3030
TypeArray(bridged: bridged.getGenericParams())
3131
}
3232

33-
public func mapTypeIntoContext(_ type: Type) -> Type {
34-
Type(bridged: bridged.mapTypeIntoContext(type.bridged))
33+
public func mapTypeIntoEnvironment(_ type: Type) -> Type {
34+
Type(bridged: bridged.mapTypeIntoEnvironment(type.bridged))
3535
}
3636

3737
public var isEmpty: Bool { bridged.impl == nil }

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ final public class Function : CustomStringConvertible, HasShortDescription, Hash
8686
SubstitutionMap(bridged: bridged.getForwardingSubstitutionMap())
8787
}
8888

89-
public func mapTypeIntoContext(_ type: AST.`Type`) -> AST.`Type` {
90-
return AST.`Type`(bridged: bridged.mapTypeIntoContext(type.bridged))
89+
public func mapTypeIntoEnvironment(_ type: AST.`Type`) -> AST.`Type` {
90+
return AST.`Type`(bridged: bridged.mapTypeIntoEnvironment(type.bridged))
9191
}
9292

9393
/// Returns true if the function is a definition and not only an external declaration.

SwiftCompilerSources/Sources/SIL/Type.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public struct Type : TypeProperties, CustomStringConvertible, NoReflectionChildr
144144
public var hasValidSignatureForEmbedded: Bool {
145145
let genericSignature = invocationGenericSignatureOfFunction
146146
for genParam in genericSignature.genericParameters {
147-
let mappedParam = genericSignature.mapTypeIntoContext(genParam)
147+
let mappedParam = genericSignature.mapTypeIntoEnvironment(genParam)
148148
if mappedParam.isArchetype && !mappedParam.archetypeRequiresClass {
149149
return false
150150
}

include/swift/AST/ASTBridging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3074,7 +3074,7 @@ struct BridgedGenericSignature {
30743074
BRIDGED_INLINE swift::GenericSignature unbridged() const;
30753075
BridgedOwnedString getDebugDescription() const;
30763076
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTTypeArray getGenericParams() const;
3077-
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType mapTypeIntoContext(BridgedASTType type) const;
3077+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedASTType mapTypeIntoEnvironment(BridgedASTType type) const;
30783078
};
30793079

30803080
struct BridgedFingerprint {

include/swift/AST/ASTBridgingImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,8 @@ BridgedASTTypeArray BridgedGenericSignature::getGenericParams() const {
869869
return {unbridged().getGenericParams()};
870870
}
871871

872-
BridgedASTType BridgedGenericSignature::mapTypeIntoContext(BridgedASTType type) const {
873-
return {unbridged().getGenericEnvironment()->mapTypeIntoContext(type.unbridged()).getPointer()};
872+
BridgedASTType BridgedGenericSignature::mapTypeIntoEnvironment(BridgedASTType type) const {
873+
return {unbridged().getGenericEnvironment()->mapTypeIntoEnvironment(type.unbridged()).getPointer()};
874874
}
875875

876876
//===----------------------------------------------------------------------===//

include/swift/AST/AnyFunctionRef.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class AnyFunctionRef {
9696
Type getBodyResultType() const {
9797
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
9898
if (auto *FD = dyn_cast<FuncDecl>(AFD))
99-
return FD->mapTypeIntoContext(FD->getResultInterfaceType());
99+
return FD->mapTypeIntoEnvironment(FD->getResultInterfaceType());
100100
return TupleType::getEmpty(AFD->getASTContext());
101101
}
102102
return cast<AbstractClosureExpr *>(TheFunction)->getResultType();
@@ -308,7 +308,7 @@ class AnyFunctionRef {
308308
auto valueTy = AD->getStorage()->getValueInterfaceType()
309309
->getReferenceStorageReferent();
310310
if (mapIntoContext)
311-
valueTy = AD->mapTypeIntoContext(valueTy);
311+
valueTy = AD->mapTypeIntoEnvironment(valueTy);
312312
YieldTypeFlags flags(isYieldingMutableAccessor(AD->getAccessorKind())
313313
? ParamSpecifier::InOut
314314
: ParamSpecifier::LegacyShared);

include/swift/AST/DeclContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ class alignas(1 << DeclContextAlignInBits) DeclContext
441441
GenericEnvironment *getGenericEnvironmentOfContext() const;
442442

443443
/// Map an interface type to a contextual type within this context.
444-
Type mapTypeIntoContext(Type type) const;
444+
Type mapTypeIntoEnvironment(Type type) const;
445445

446446
/// Returns this or the first local parent context, or nullptr if it is not
447447
/// contained in one.

include/swift/AST/GenericEnvironment.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ struct ElementEnvironmentData {
7575
/// Describes the mapping between archetypes and interface types for the
7676
/// generic parameters of a DeclContext.
7777
///
78-
/// The most frequently used method here is mapTypeIntoContext(), which
78+
/// The most frequently used method here is mapTypeIntoEnvironment(), which
7979
/// maps an interface type to a type written in terms of the generic
8080
/// environment's archetypes; to go in the other direction, use
81-
/// TypeBase::mapTypeOutOfContext().
81+
/// TypeBase::mapTypeOutOfEnvironment().
8282
///
8383
class alignas(1 << DeclAlignInBits) GenericEnvironment final
8484
: private llvm::TrailingObjects<
@@ -279,14 +279,14 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
279279
Type maybeApplyOuterContextSubstitutions(Type type) const;
280280

281281
/// Map an interface type to a contextual type.
282-
static Type mapTypeIntoContext(GenericEnvironment *genericEnv,
282+
static Type mapTypeIntoEnvironment(GenericEnvironment *genericEnv,
283283
Type type);
284284

285285
/// Map an interface type to a contextual type.
286-
Type mapTypeIntoContext(Type type) const;
286+
Type mapTypeIntoEnvironment(Type type) const;
287287

288288
/// Map a generic parameter type to a contextual type.
289-
Type mapTypeIntoContext(GenericTypeParamType *type) const;
289+
Type mapTypeIntoEnvironment(GenericTypeParamType *type) const;
290290

291291
/// Map a type parameter type to a contextual type.
292292
Type getOrCreateArchetypeFromInterfaceType(Type depType);
@@ -327,7 +327,7 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
327327
///
328328
/// This operation will also reabstract dependent types according to the
329329
/// abstraction level of their associated type requirements.
330-
SILType mapTypeIntoContext(SILModule &M, SILType type) const;
330+
SILType mapTypeIntoEnvironment(SILModule &M, SILType type) const;
331331

332332
/// Returns a substitution map that sends every generic parameter to its
333333
/// corresponding archetype in this generic environment.

include/swift/AST/ProtocolConformanceRef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class ProtocolConformanceRef {
199199
ProtocolConformanceRef subst(InFlightSubstitution &IFS) const;
200200

201201
/// Map contextual types to interface types in the conformance.
202-
ProtocolConformanceRef mapConformanceOutOfContext() const;
202+
ProtocolConformanceRef mapConformanceOutOfEnvironment() const;
203203

204204
/// Look up the type witness for an associated type declaration in this
205205
/// conformance.

include/swift/AST/SubstitutionMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class SubstitutionMap {
209209

210210
/// Swap archetypes in the substitution map's replacement types with their
211211
/// interface types.
212-
SubstitutionMap mapReplacementTypesOutOfContext() const;
212+
SubstitutionMap mapReplacementTypesOutOfEnvironment() const;
213213

214214
/// Verify that the conformances stored in this substitution map match the
215215
/// replacement types provided.

0 commit comments

Comments
 (0)