Skip to content

Commit ce1afc3

Browse files
committed
[NFC] TypeResolution: Add a 'forInterface' factory constructor that takes a generic environment
1 parent c237f09 commit ce1afc3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,18 @@ TypeResolution
7272
TypeResolution::forInterface(DeclContext *dc, TypeResolutionOptions options,
7373
OpenUnboundGenericTypeFn unboundTyOpener,
7474
HandlePlaceholderTypeReprFn placeholderHandler) {
75+
return forInterface(dc, dc->getGenericEnvironmentOfContext(), options,
76+
unboundTyOpener, placeholderHandler);
77+
}
78+
79+
TypeResolution
80+
TypeResolution::forInterface(DeclContext *dc, GenericEnvironment *genericEnv,
81+
TypeResolutionOptions options,
82+
OpenUnboundGenericTypeFn unboundTyOpener,
83+
HandlePlaceholderTypeReprFn placeholderHandler) {
7584
TypeResolution result(dc, TypeResolutionStage::Interface, options,
7685
unboundTyOpener, placeholderHandler);
86+
result.genericEnv = genericEnv;
7787
return result;
7888
}
7989

lib/Sema/TypeCheckType.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,14 @@ class TypeResolution {
328328
OpenUnboundGenericTypeFn unboundTyOpener,
329329
HandlePlaceholderTypeReprFn placeholderHandler);
330330

331+
/// Form a type resolution for an interface type, which is a complete
332+
/// description of the type using generic parameters.
333+
static TypeResolution
334+
forInterface(DeclContext *dc, GenericEnvironment *genericEnv,
335+
TypeResolutionOptions opts,
336+
OpenUnboundGenericTypeFn unboundTyOpener,
337+
HandlePlaceholderTypeReprFn placeholderHandler);
338+
331339
/// Form a type resolution for a contextual type, which is a complete
332340
/// description of the type using the archetypes of the given declaration
333341
/// context.

0 commit comments

Comments
 (0)