Skip to content

Commit 7a6c079

Browse files
authored
Merge pull request #60429 from slavapestov/sil-opened-archetype-syntax
Sema: New syntax for @opened archetypes in textual SIL
2 parents 6c7e8c4 + d222ac5 commit 7a6c079

File tree

135 files changed

+1746
-1633
lines changed

Some content is hidden

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

135 files changed

+1746
-1633
lines changed

include/swift/AST/ASTContext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,10 @@ class ASTContext final {
13251325
bool isRecursivelyConstructingRequirementMachine(
13261326
const ProtocolDecl *proto);
13271327

1328+
/// Retrieve a generic parameter list with a single parameter named `Self`.
1329+
/// This is for parsing @opened archetypes in textual SIL.
1330+
GenericParamList *getSelfGenericParamList(DeclContext *dc) const;
1331+
13281332
/// Retrieve a generic signature with a single unconstrained type parameter,
13291333
/// like `<T>`.
13301334
CanGenericSignature getSingleGenericParameterSignature() const;

include/swift/AST/Attr.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,6 +2493,9 @@ class TypeAttributes {
24932493
// For an opened existential type, the known ID.
24942494
Optional<UUID> OpenedID;
24952495

2496+
// For an opened existential type, the constraint type.
2497+
Optional<TypeRepr *> ConstraintType;
2498+
24962499
// For a reference to an opaque return type, the mangled name and argument
24972500
// index into the generic signature.
24982501
struct OpaqueReturnTypeRef {
@@ -2581,6 +2584,9 @@ class TypeAttributes {
25812584
bool hasOpenedID() const { return OpenedID.hasValue(); }
25822585
UUID getOpenedID() const { return *OpenedID; }
25832586

2587+
bool hasConstraintType() const { return ConstraintType.hasValue(); }
2588+
TypeRepr *getConstraintType() const { return *ConstraintType; }
2589+
25842590
/// Given a name like "autoclosure", return the type attribute ID that
25852591
/// corresponds to it. This returns TAK_Count on failure.
25862592
///

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5089,8 +5089,10 @@ ERROR(differentiable_function_type_no_differentiability_parameters,
50895089
(/*isLinear*/ bool))
50905090

50915091
// SIL
5092-
ERROR(opened_non_protocol,none,
5093-
"@opened cannot be applied to non-protocol type %0", (Type))
5092+
ERROR(opened_bad_constraint_type,none,
5093+
"@opened constraint type %0 is not a protocol or protocol composition", (Type))
5094+
ERROR(opened_bad_interface_type,none,
5095+
"@opened interface type %0 is not a type parameter", (Type))
50945096
ERROR(sil_function_ellipsis,PointsToFirstBadToken,
50955097
"SIL function types cannot be variadic", ())
50965098
ERROR(sil_function_input_label,PointsToFirstBadToken,

lib/AST/ASTContext.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ struct ASTContext::Implementation {
331331
/// Stores information about lazy deserialization of various declarations.
332332
llvm::DenseMap<const DeclContext *, LazyContextData *> LazyContexts;
333333

334+
/// A fake generic parameter list <Self> for parsing @opened archetypes
335+
/// in textual SIL.
336+
GenericParamList *SelfGenericParamList = nullptr;
337+
334338
/// The single-parameter generic signature with no constraints, <T>.
335339
CanGenericSignature SingleGenericParameterSignature;
336340

@@ -5152,6 +5156,26 @@ ASTContext::getClangTypeForIRGen(Type ty) {
51525156
return getClangTypeConverter().convert(ty).getTypePtrOrNull();
51535157
}
51545158

5159+
GenericParamList *ASTContext::getSelfGenericParamList(DeclContext *dc) const {
5160+
auto *theParamList = getImpl().SelfGenericParamList;
5161+
if (theParamList)
5162+
return theParamList;
5163+
5164+
// Note: we always return a GenericParamList rooted at the first
5165+
// DeclContext this was called with. Since this is just a giant
5166+
// hack for SIL mode, that should be OK.
5167+
auto *selfParam = GenericTypeParamDecl::create(
5168+
dc, Id_Self, SourceLoc(),
5169+
/*isTypeSequence=*/false, /*depth=*/0, /*index=*/0,
5170+
/*isOpaqueType=*/false, /*opaqueTypeRepr=*/nullptr);
5171+
5172+
theParamList = GenericParamList::create(
5173+
const_cast<ASTContext &>(*this), SourceLoc(), {selfParam}, SourceLoc());
5174+
getImpl().SelfGenericParamList = theParamList;
5175+
5176+
return theParamList;
5177+
}
5178+
51555179
CanGenericSignature ASTContext::getSingleGenericParameterSignature() const {
51565180
if (auto theSig = getImpl().SingleGenericParameterSignature)
51575181
return theSig;

lib/AST/ASTPrinter.cpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "swift/AST/ExistentialLayout.h"
2727
#include "swift/AST/Expr.h"
2828
#include "swift/AST/FileUnit.h"
29+
#include "swift/AST/GenericEnvironment.h"
2930
#include "swift/AST/GenericParamList.h"
3031
#include "swift/AST/GenericSignature.h"
3132
#include "swift/AST/Module.h"
@@ -6307,14 +6308,25 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
63076308
}
63086309

63096310
void visitOpenedArchetypeType(OpenedArchetypeType *T) {
6310-
if (auto parent = T->getParent()) {
6311-
printArchetypeCommon(T);
6312-
return;
6313-
}
6311+
if (Options.PrintForSIL) {
6312+
Printer << "@opened(\"" << T->getOpenedExistentialID() << "\", ";
6313+
visit(T->getGenericEnvironment()->getOpenedExistentialType());
6314+
Printer << ") ";
6315+
6316+
llvm::DenseMap<CanType, Identifier> newAlternativeTypeNames;
63146317

6315-
if (Options.PrintForSIL)
6316-
Printer << "@opened(\"" << T->getOpenedExistentialID() << "\") ";
6317-
visit(T->getExistentialType());
6318+
auto interfaceTy = T->getInterfaceType();
6319+
auto selfTy = interfaceTy->getRootGenericParam();
6320+
auto &ctx = selfTy->getASTContext();
6321+
newAlternativeTypeNames[selfTy->getCanonicalType()] = ctx.Id_Self;
6322+
6323+
PrintOptions subOptions = Options;
6324+
subOptions.AlternativeTypeNames = &newAlternativeTypeNames;
6325+
TypePrinter sub(Printer, subOptions);
6326+
sub.visit(interfaceTy);
6327+
} else {
6328+
visit(T->getExistentialType());
6329+
}
63186330
}
63196331

63206332
void printDependentMember(DependentMemberType *T) {

lib/Parse/ParseDecl.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3715,6 +3715,17 @@ ParserStatus Parser::parseTypeAttribute(TypeAttributes &Attributes,
37153715
} else {
37163716
diagnose(Tok, diag::opened_attribute_id_value);
37173717
}
3718+
3719+
if (Tok.is(tok::comma)) {
3720+
consumeToken(tok::comma);
3721+
3722+
auto constraintType = parseType(diag::expected_type);
3723+
if (constraintType.isNonNull())
3724+
Attributes.ConstraintType = constraintType.getPtrOrNull();
3725+
} else {
3726+
diagnose(Tok, diag::attr_expected_comma, "@opened", false);
3727+
}
3728+
37183729
parseMatchingToken(tok::r_paren, endLoc,
37193730
diag::opened_attribute_expected_rparen,
37203731
beginLoc);

lib/Sema/TypeCheckType.cpp

Lines changed: 69 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,6 +1924,10 @@ namespace {
19241924
return diags.diagnose(std::forward<ArgTypes>(Args)...);
19251925
}
19261926

1927+
NeverNullType resolveOpenedExistentialArchetype(
1928+
TypeAttributes &attrs, TypeRepr *repr,
1929+
TypeResolutionOptions options);
1930+
19271931
NeverNullType resolveAttributedType(AttributedTypeRepr *repr,
19281932
TypeResolutionOptions options);
19291933
NeverNullType resolveAttributedType(TypeAttributes &attrs, TypeRepr *repr,
@@ -2307,6 +2311,67 @@ TypeResolver::resolveAttributedType(AttributedTypeRepr *repr,
23072311
return resolveAttributedType(attrs, repr->getTypeRepr(), options);
23082312
}
23092313

2314+
/// In SIL, handle '@opened(UUID, constraintType) interfaceType',
2315+
/// which creates an opened archetype.
2316+
NeverNullType
2317+
TypeResolver::resolveOpenedExistentialArchetype(
2318+
TypeAttributes &attrs, TypeRepr *repr,
2319+
TypeResolutionOptions options) {
2320+
options.setContext(None);
2321+
2322+
auto *dc = getDeclContext();
2323+
auto &ctx = dc->getASTContext();
2324+
2325+
// The interface type is the type wrapped by the attribute. Resolve it
2326+
// with the fake <Self> generic parameter list uniquely stored in the
2327+
// ASTContext, and use structural resolution to avoid querying the
2328+
// DeclContext's generic signature, which is not the right signature
2329+
// for this.
2330+
auto structuralResolution = TypeResolution::forStructural(
2331+
dc, options,
2332+
/*unboundTyOpener*/ nullptr,
2333+
/*placeholderHandler*/ nullptr);
2334+
TypeResolver interfaceTypeResolver(structuralResolution,
2335+
ctx.getSelfGenericParamList(dc));
2336+
auto interfaceType = interfaceTypeResolver.resolveType(repr, options);
2337+
2338+
// The constraint type is stored inside the attribute. It is resolved
2339+
// normally, as if it were written in the current context.
2340+
auto constraintType = resolveType(attrs.getConstraintType(), options);
2341+
2342+
Type archetypeType;
2343+
if (!constraintType->isExistentialType()) {
2344+
diagnoseInvalid(repr, attrs.getLoc(TAK_opened),
2345+
diag::opened_bad_constraint_type,
2346+
constraintType);
2347+
2348+
archetypeType = ErrorType::get(constraintType->getASTContext());
2349+
} else if (!interfaceType->isTypeParameter()) {
2350+
diagnoseInvalid(repr, attrs.getLoc(TAK_opened),
2351+
diag::opened_bad_interface_type,
2352+
interfaceType);
2353+
2354+
archetypeType = ErrorType::get(interfaceType->getASTContext());
2355+
} {
2356+
// The constraint type is written with respect to the surrounding
2357+
// generic environment.
2358+
constraintType = GenericEnvironment::mapTypeIntoContext(
2359+
resolution.getGenericSignature().getGenericEnvironment(),
2360+
constraintType);
2361+
2362+
// The opened existential type is formed by mapping the interface type
2363+
// into a new opened generic environment.
2364+
archetypeType = OpenedArchetypeType::get(constraintType->getCanonicalType(),
2365+
interfaceType,
2366+
GenericSignature(),
2367+
attrs.getOpenedID());
2368+
}
2369+
2370+
attrs.clearAttribute(TAK_opened);
2371+
2372+
return archetypeType;
2373+
}
2374+
23102375
NeverNullType
23112376
TypeResolver::resolveAttributedType(TypeAttributes &attrs, TypeRepr *repr,
23122377
TypeResolutionOptions options) {
@@ -2715,6 +2780,10 @@ TypeResolver::resolveAttributedType(TypeAttributes &attrs, TypeRepr *repr,
27152780
attrs.clearAttribute(TAK_unchecked);
27162781
}
27172782

2783+
if (attrs.has(TAK_opened)) {
2784+
ty = resolveOpenedExistentialArchetype(attrs, repr, options);
2785+
}
2786+
27182787
auto instanceOptions = options;
27192788
instanceOptions.setContext(None);
27202789

@@ -2834,21 +2903,6 @@ TypeResolver::resolveAttributedType(TypeAttributes &attrs, TypeRepr *repr,
28342903
attrs.clearAttribute(TAK_noDerivative);
28352904
}
28362905

2837-
// In SIL, handle @opened (n), which creates an existential archetype.
2838-
if (attrs.has(TAK_opened)) {
2839-
if (!ty->isExistentialType()) {
2840-
diagnoseInvalid(repr, attrs.getLoc(TAK_opened), diag::opened_non_protocol,
2841-
ty);
2842-
} else {
2843-
ty = GenericEnvironment::mapTypeIntoContext(
2844-
resolution.getGenericSignature().getGenericEnvironment(), ty);
2845-
ty = OpenedArchetypeType::get(ty->getCanonicalType(),
2846-
resolution.getGenericSignature(),
2847-
attrs.OpenedID);
2848-
}
2849-
attrs.clearAttribute(TAK_opened);
2850-
}
2851-
28522906
// In SIL files *only*, permit @weak and @unowned to apply directly to types.
28532907
if (attrs.hasOwnership()) {
28542908
if (auto SF = getDeclContext()->getParentSourceFile()) {

test/ClangImporter/serialization-sil.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@
99
public func testPartialApply(_ obj: Test) {
1010
// CHECK-LABEL: @$s4Test16testPartialApplyyySoAA_pF : $@convention(thin) (@guaranteed Test) -> () {
1111
if let curried1 = obj.normalObject {
12-
// CHECK: dynamic_method_br [[CURRIED1_OBJ:%.+]] : $@opened([[CURRIED1_EXISTENTIAL:.+]]) Test, #Test.normalObject!foreign, [[CURRIED1_TRUE:[^,]+]], [[CURRIED1_FALSE:[^,]+]]
12+
// CHECK: dynamic_method_br [[CURRIED1_OBJ:%.+]] : $@opened([[CURRIED1_EXISTENTIAL:.+]], Test) Self, #Test.normalObject!foreign, [[CURRIED1_TRUE:[^,]+]], [[CURRIED1_FALSE:[^,]+]]
1313
// CHECK: [[CURRIED1_FALSE]]:
14-
// CHECK: [[CURRIED1_TRUE]]([[CURRIED1_METHOD:%.+]] : $@convention(objc_method) (@opened([[CURRIED1_EXISTENTIAL]]) Test) -> @autoreleased AnyObject):
14+
// CHECK: [[CURRIED1_TRUE]]([[CURRIED1_METHOD:%.+]] : $@convention(objc_method) (@opened([[CURRIED1_EXISTENTIAL]], Test) Self) -> @autoreleased AnyObject):
1515
// CHECK: [[CURRIED1_OBJECT_COPY:%.*]] = copy_value [[CURRIED1_OBJ]]
16-
// CHECK: [[CURRIED1_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[CURRIED1_METHOD]]([[CURRIED1_OBJECT_COPY]]) : $@convention(objc_method) (@opened([[CURRIED1_EXISTENTIAL]]) Test) -> @autoreleased AnyObject
16+
// CHECK: [[CURRIED1_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[CURRIED1_METHOD]]([[CURRIED1_OBJECT_COPY]]) : $@convention(objc_method) (@opened([[CURRIED1_EXISTENTIAL]], Test) Self) -> @autoreleased AnyObject
1717
// CHECK: [[CURRIED1_THUNK:%.+]] = function_ref @$syXlIego_ypIegr_TR : $@convention(thin) (@guaranteed @callee_guaranteed () -> @owned AnyObject) -> @out Any
1818
// CHECK: = partial_apply [callee_guaranteed] [[CURRIED1_THUNK]]([[CURRIED1_PARTIAL]])
1919
curried1()
2020
}
2121
if let curried2 = obj.innerPointer {
22-
// CHECK: dynamic_method_br [[CURRIED2_OBJ:%.+]] : $@opened([[CURRIED2_EXISTENTIAL:.+]]) Test, #Test.innerPointer!foreign, [[CURRIED2_TRUE:[^,]+]], [[CURRIED2_FALSE:[^,]+]]
22+
// CHECK: dynamic_method_br [[CURRIED2_OBJ:%.+]] : $@opened([[CURRIED2_EXISTENTIAL:.+]], Test) Self, #Test.innerPointer!foreign, [[CURRIED2_TRUE:[^,]+]], [[CURRIED2_FALSE:[^,]+]]
2323
// CHECK: [[CURRIED2_FALSE]]:
24-
// CHECK: [[CURRIED2_TRUE]]([[CURRIED2_METHOD:%.+]] : $@convention(objc_method) (@opened([[CURRIED2_EXISTENTIAL]]) Test) -> @unowned_inner_pointer UnsafeMutableRawPointer):
24+
// CHECK: [[CURRIED2_TRUE]]([[CURRIED2_METHOD:%.+]] : $@convention(objc_method) (@opened([[CURRIED2_EXISTENTIAL]], Test) Self) -> @unowned_inner_pointer UnsafeMutableRawPointer):
2525
// CHECK: [[CURRIED2_OBJ_COPY:%.*]] = copy_value [[CURRIED2_OBJ]]
26-
// CHECK: [[CURRIED2_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[CURRIED2_METHOD]]([[CURRIED2_OBJ_COPY]]) : $@convention(objc_method) (@opened([[CURRIED2_EXISTENTIAL]]) Test) -> @unowned_inner_pointer UnsafeMutableRawPointer
26+
// CHECK: [[CURRIED2_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[CURRIED2_METHOD]]([[CURRIED2_OBJ_COPY]]) : $@convention(objc_method) (@opened([[CURRIED2_EXISTENTIAL]], Test) Self) -> @unowned_inner_pointer UnsafeMutableRawPointer
2727
curried2()
2828
}
2929
if let prop1 = obj.normalObjectProp {
30-
// CHECK: dynamic_method_br [[PROP1_OBJ:%.+]] : $@opened([[PROP1_EXISTENTIAL:.+]]) Test, #Test.normalObjectProp!getter.foreign, [[PROP1_TRUE:[^,]+]], [[PROP1_FALSE:[^,]+]]
30+
// CHECK: dynamic_method_br [[PROP1_OBJ:%.+]] : $@opened([[PROP1_EXISTENTIAL:.+]], Test) Self, #Test.normalObjectProp!getter.foreign, [[PROP1_TRUE:[^,]+]], [[PROP1_FALSE:[^,]+]]
3131
// CHECK: [[PROP1_FALSE]]:
32-
// CHECK: [[PROP1_TRUE]]([[PROP1_METHOD:%.+]] : $@convention(objc_method) (@opened([[PROP1_EXISTENTIAL]]) Test) -> @autoreleased AnyObject):
32+
// CHECK: [[PROP1_TRUE]]([[PROP1_METHOD:%.+]] : $@convention(objc_method) (@opened([[PROP1_EXISTENTIAL]], Test) Self) -> @autoreleased AnyObject):
3333
// CHECK: [[PROP1_OBJ_COPY:%.*]] = copy_value [[PROP1_OBJ]]
34-
// CHECK: [[PROP1_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[PROP1_METHOD]]([[PROP1_OBJ_COPY]]) : $@convention(objc_method) (@opened([[PROP1_EXISTENTIAL]]) Test) -> @autoreleased AnyObject
34+
// CHECK: [[PROP1_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[PROP1_METHOD]]([[PROP1_OBJ_COPY]]) : $@convention(objc_method) (@opened([[PROP1_EXISTENTIAL]], Test) Self) -> @autoreleased AnyObject
3535
// CHECK: = apply [[PROP1_PARTIAL]]() : $@callee_guaranteed () -> @owned AnyObject
3636
_ = prop1
3737
}
3838
if let prop2 = obj.innerPointerProp {
39-
// CHECK: dynamic_method_br [[PROP2_OBJ:%.+]] : $@opened([[PROP2_EXISTENTIAL:.+]]) Test, #Test.innerPointerProp!getter.foreign, [[PROP2_TRUE:[^,]+]], [[PROP2_FALSE:[^,]+]]
39+
// CHECK: dynamic_method_br [[PROP2_OBJ:%.+]] : $@opened([[PROP2_EXISTENTIAL:.+]], Test) Self, #Test.innerPointerProp!getter.foreign, [[PROP2_TRUE:[^,]+]], [[PROP2_FALSE:[^,]+]]
4040
// CHECK: [[PROP2_FALSE]]:
41-
// CHECK: [[PROP2_TRUE]]([[PROP2_METHOD:%.+]] : $@convention(objc_method) (@opened([[PROP2_EXISTENTIAL]]) Test) -> @unowned_inner_pointer UnsafeMutableRawPointer):
41+
// CHECK: [[PROP2_TRUE]]([[PROP2_METHOD:%.+]] : $@convention(objc_method) (@opened([[PROP2_EXISTENTIAL]], Test) Self) -> @unowned_inner_pointer UnsafeMutableRawPointer):
4242
// CHECK: [[PROP2_OBJ_COPY:%.*]] = copy_value [[PROP2_OBJ]]
43-
// CHECK: [[PROP2_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[PROP2_METHOD]]([[PROP2_OBJ_COPY]]) : $@convention(objc_method) (@opened([[PROP2_EXISTENTIAL]]) Test) -> @unowned_inner_pointer UnsafeMutableRawPointer
43+
// CHECK: [[PROP2_PARTIAL:%.+]] = partial_apply [callee_guaranteed] [[PROP2_METHOD]]([[PROP2_OBJ_COPY]]) : $@convention(objc_method) (@opened([[PROP2_EXISTENTIAL]], Test) Self) -> @unowned_inner_pointer UnsafeMutableRawPointer
4444
// CHECK: = apply [[PROP2_PARTIAL]]() : $@callee_guaranteed () -> UnsafeMutableRawPointer
4545
_ = prop2
4646
}

test/Constraints/ranking.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,35 @@ func genericNoOptional<T>(_: T) {}
3232

3333
// CHECK-LABEL: sil hidden [ossa] @$s7ranking22propertyVersusFunctionyyAA1P_p_xtAaCRzlF
3434
func propertyVersusFunction<T : P>(_ p: P, _ t: T) {
35-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
35+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
3636
let _ = p.p
37-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
37+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
3838
let _: P = p.p
3939
// CHECK: function_ref @$s7ranking22propertyVersusFunctionyyAA1P_p_xtAaCRzlFyAaC_pcAaC_pcfu_ : $@convention(thin) (@in_guaranteed P) -> @owned @callee_guaranteed (@in_guaranteed P) -> ()
4040
let _: (P) -> () = p.p
41-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
41+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
4242
let _: P? = p.p
43-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
43+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
4444
let _: Any = p.p
45-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
45+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
4646
let _: Any? = p.p
4747

48-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
48+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
4949
// CHECK: function_ref @$s7ranking15genericOverloadyyxlF
5050
genericOverload(p.p)
51-
// CHECK: witness_method $@opened("{{.*}}") P, #P.q!getter
51+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.q!getter
5252
// CHECK: function_ref @$s7ranking15genericOverloadyyxSglF
5353
genericOverload(p.q)
54-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
54+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
5555
// CHECK: function_ref @$s7ranking15genericOptionalyyxSglF
5656
genericOptional(p.p)
57-
// CHECK: witness_method $@opened("{{.*}}") P, #P.q!getter
57+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.q!getter
5858
// CHECK: function_ref @$s7ranking15genericOptionalyyxSglF
5959
genericOptional(p.q)
60-
// CHECK: witness_method $@opened("{{.*}}") P, #P.p!getter
60+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.p!getter
6161
// CHECK: function_ref @$s7ranking17genericNoOptionalyyxlF
6262
genericNoOptional(p.p)
63-
// CHECK: witness_method $@opened("{{.*}}") P, #P.q!getter
63+
// CHECK: witness_method $@opened("{{.*}}", P) Self, #P.q!getter
6464
// CHECK: function_ref @$s7ranking17genericNoOptionalyyxlF
6565
genericNoOptional(p.q)
6666

test/IRGen/async/run-call-existential-to-void.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ bb0(%int : $Int64, %S_type : $@thin S.Type):
4242
// CHECK-LL: define hidden swift{{(tail)?}}cc void @existentialToVoid(
4343
sil hidden @existentialToVoid : $@async @convention(thin) (@in_guaranteed P) -> () {
4444
bb0(%existential : $*P):
45-
%existential_addr = open_existential_addr immutable_access %existential : $*P to $*@opened("B2796A9C-FEBE-11EA-84BB-D0817AD71B77") P
45+
%existential_addr = open_existential_addr immutable_access %existential : $*P to $*@opened("B2796A9C-FEBE-11EA-84BB-D0817AD71B77", P) Self
4646
%any = alloc_stack $Any
47-
%any_addr = init_existential_addr %any : $*Any, $@opened("B2796A9C-FEBE-11EA-84BB-D0817AD71B77") P
48-
copy_addr %existential_addr to [initialization] %any_addr : $*@opened("B2796A9C-FEBE-11EA-84BB-D0817AD71B77") P
47+
%any_addr = init_existential_addr %any : $*Any, $@opened("B2796A9C-FEBE-11EA-84BB-D0817AD71B77", P) Self
48+
copy_addr %existential_addr to [initialization] %any_addr : $*@opened("B2796A9C-FEBE-11EA-84BB-D0817AD71B77", P) Self
4949
%printAny = function_ref @printAny : $@convention(thin) (@in_guaranteed Any) -> ()
5050
%result = apply %printAny(%any) : $@convention(thin) (@in_guaranteed Any) -> ()
5151
destroy_addr %any : $*Any

0 commit comments

Comments
 (0)