Skip to content

Commit 618b9d9

Browse files
committed
[Sema] RuntimeMetadata: Use CustomAttrTypeRequest while synthesizing generator expression
This would make sure that: - CustomAttr gets a type set - All of the explicitly provided generic arguments are respected
1 parent f7f2e37 commit 618b9d9

File tree

5 files changed

+114
-36
lines changed

5 files changed

+114
-36
lines changed

lib/Sema/TypeCheckAttr.cpp

+64-21
Original file line numberDiff line numberDiff line change
@@ -3652,9 +3652,6 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) {
36523652
case DeclKind::Class:
36533653
case DeclKind::Struct:
36543654
case DeclKind::Enum: {
3655-
// protocols are not accepted because they are
3656-
// generic over `Self`.
3657-
36583655
auto *NTD = cast<NominalTypeDecl>(D);
36593656

36603657
// Non-generic types only.
@@ -3664,6 +3661,12 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) {
36643661
return;
36653662
}
36663663

3664+
case DeclKind::Protocol: {
3665+
// Allow on protocols because they are sources
3666+
// of inference.
3667+
return;
3668+
}
3669+
36673670
case DeclKind::Func: {
36683671
// Non-generic functions/methods only.
36693672
if (isGenericContext(cast<FuncDecl>(D)))
@@ -7280,26 +7283,66 @@ GetRuntimeDiscoverableAttributes::evaluate(Evaluator &evaluator,
72807283
auto &ctx = decl->getASTContext();
72817284

72827285
llvm::SmallMapVector<NominalTypeDecl *, CustomAttr *, 4> attrs;
7283-
forEachCustomAttribute<RuntimeMetadataAttr>(
7284-
decl, [&](CustomAttr *attr, NominalTypeDecl *attrType) {
7285-
if (attrs.count(attrType)) {
7286-
ctx.Diags
7287-
.diagnose(attr->getLocation(),
7288-
diag::duplicate_runtime_discoverable_attr)
7289-
.highlight(attr->getRange());
7290-
attr->setInvalid();
7291-
return;
7292-
}
72937286

7294-
(void)attrs.insert({attrType, attr});
7295-
});
7287+
enum class GatheringMode { Direct, Inference };
7288+
7289+
auto gatherRuntimeAttrsOnDecl =
7290+
[&](ValueDecl *decl,
7291+
llvm::SmallMapVector<NominalTypeDecl *, CustomAttr *, 4> &attrs,
7292+
GatheringMode mode) {
7293+
forEachCustomAttribute<RuntimeMetadataAttr>(
7294+
decl, [&](CustomAttr *attr, NominalTypeDecl *attrType) {
7295+
// Ignore duplicate attrs if they are inferred from
7296+
// protocols.
7297+
if (attrs.count(attrType) && mode == GatheringMode::Direct) {
7298+
ctx.Diags
7299+
.diagnose(attr->getLocation(),
7300+
diag::duplicate_runtime_discoverable_attr)
7301+
.highlight(attr->getRange());
7302+
attr->setInvalid();
7303+
return;
7304+
}
72967305

7297-
auto result = ctx.AllocateUninitialized<CustomAttr *>(attrs.size());
7298-
{
7299-
unsigned index = 0;
7300-
for (const auto &entry : attrs)
7301-
result[index++] = entry.second;
7306+
(void)attrs.insert({attrType, attr});
7307+
});
7308+
};
7309+
7310+
auto copyAttrs =
7311+
[&](llvm::SmallMapVector<NominalTypeDecl *, CustomAttr *, 4> &attrs)
7312+
-> ArrayRef<CustomAttr *> {
7313+
auto copy = ctx.AllocateUninitialized<CustomAttr *>(attrs.size());
7314+
{
7315+
unsigned index = 0;
7316+
for (const auto &entry : attrs)
7317+
copy[index++] = entry.second;
7318+
}
7319+
return copy;
7320+
};
7321+
7322+
// First, gather all of the runtime attributes directly on the decl.
7323+
gatherRuntimeAttrsOnDecl(decl, attrs, GatheringMode::Direct);
7324+
7325+
auto *NTD = dyn_cast<NominalTypeDecl>(decl);
7326+
// Attribute inference is only possible from protocol conformances.
7327+
if (!NTD || isa<ProtocolDecl>(NTD))
7328+
return copyAttrs(attrs);
7329+
7330+
// Gather any attributes inferred from (explicit) protocol conformances
7331+
// associated with the declaration of the type.
7332+
for (unsigned i : indices(NTD->getInherited())) {
7333+
auto inheritedType = evaluateOrDefault(
7334+
ctx.evaluator,
7335+
InheritedTypeRequest{NTD, i, TypeResolutionStage::Interface}, Type());
7336+
7337+
if (!(inheritedType && inheritedType->isConstraintType()))
7338+
continue;
7339+
7340+
auto *protocol = inheritedType->getAnyNominal();
7341+
if (!protocol)
7342+
continue;
7343+
7344+
gatherRuntimeAttrsOnDecl(protocol, attrs, GatheringMode::Inference);
73027345
}
73037346

7304-
return result;
7347+
return copyAttrs(attrs);
73057348
}

lib/Sema/TypeCheckRuntimeMetadataAttr.cpp

+7-14
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ Expr *SynthesizeRuntimeMetadataAttrGenerator::evaluate(
5656
Evaluator &evaluator, CustomAttr *attr, ValueDecl *attachedTo) const {
5757
auto &ctx = attachedTo->getASTContext();
5858

59-
auto *attrTypeDecl = evaluateOrDefault(
59+
auto attrType = evaluateOrDefault(
6060
ctx.evaluator,
61-
CustomAttrNominalRequest{attr, attachedTo->getDeclContext()}, nullptr);
61+
CustomAttrTypeRequest{attr, attachedTo->getDeclContext(),
62+
CustomAttrTypeKind::RuntimeMetadata},
63+
nullptr);
6264

63-
if (!attrTypeDecl)
65+
if (!attrType)
6466
return nullptr;
6567

68+
auto *attrTypeDecl = attrType->getAnyNominal();
6669
assert(attrTypeDecl->getAttrs().hasAttribute<RuntimeMetadataAttr>());
6770

6871
auto *initContext = new (ctx) RuntimeAttributeInitializer(attr, attachedTo);
@@ -151,17 +154,7 @@ Expr *SynthesizeRuntimeMetadataAttrGenerator::evaluate(
151154
if (auto *repr = attr->getTypeRepr())
152155
reprRange = repr->getSourceRange();
153156

154-
auto attrTy = attrTypeDecl->getDeclaredInterfaceType();
155-
// Drop all of the generic parameters from the type and
156-
// let type-checker open them while solving.
157-
attrTy = attrTy.transform([&](Type type) -> Type {
158-
if (auto *BGT = type->getAs<BoundGenericType>()) {
159-
return UnboundGenericType::get(BGT->getDecl(), BGT->getParent(), ctx);
160-
}
161-
return type;
162-
});
163-
164-
auto typeExpr = TypeExpr::createImplicitHack(reprRange.Start, attrTy, ctx);
157+
auto typeExpr = TypeExpr::createImplicitHack(reprRange.Start, attrType, ctx);
165158

166159
// Add the initializer argument at the front of the argument list
167160
SmallVector<Argument, 4> newArgs;

test/IRGen/Inputs/runtime_attrs.swift

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ public struct Ignore<T> {
77
public struct TestAmbiguity {
88
public init<Args, Result>(attachedTo: (Args) -> Result) {}
99
}
10+
11+
@Ignore
12+
public protocol Ignored {
13+
}

test/IRGen/runtime_attributes.swift

+11-1
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@
3636
// CHECK: @"$s18runtime_attributes15TestNoAmbiguityV10testStaticyycvpZfa3RAD0cE0HF"
3737
// CHECK: @"$s18runtime_attributes15TestNoAmbiguityV8testInstyySi_SStcvpfa3RAD0cE0HF"
3838
// CHECK: @"$s18runtime_attributes15TestNoAmbiguityV8testInstyySi_Sitcvpfa3RAD0cE0HF"
39+
// CHECK: @"$s18runtime_attributes14TestInference1AaBVmvpfa3RAD6IgnoreHF"
40+
// CHECK: @"$s18runtime_attributes14TestInference2AaBCmvpfa3RAD6IgnoreHF"
41+
// CHECK: @"$s18runtime_attributes14TestInference3AaBOmvpfa3RAD6IgnoreHF"
3942

4043
// CHECK: @"$s18runtime_attributes4FlagVHa" = internal constant { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } { i32 0, i32 trunc (i64 sub (i64 ptrtoint (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8 }>* @"$s18runtime_attributes4FlagVMn" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s18runtime_attributes4FlagVHa", i32 0, i32 1) to i64)) to i32), i32 16, {{.*}} @"$s18runtime_attributes4FlagVHa", i32 0, i32 34) to i64)) to i32) }, section "__TEXT, __swift5_rattrs, regular", align 4
4144

4245
// CHECK: @"$s18runtime_attributes13OnlyPropsTestVHa" = internal constant { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } { i32 0, i32 trunc (i64 sub (i64 ptrtoint (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8 }>* @"$s18runtime_attributes13OnlyPropsTestVMn" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s18runtime_attributes13OnlyPropsTestVHa", i32 0, i32 1) to i64)) to i32), i32 4, {{.*}} @"$s18runtime_attributes13OnlyPropsTestVHa", i32 0, i32 10) to i64)) to i32) }, section "__TEXT, __swift5_rattrs, regular", align 4
4346

44-
// CHECK: @"$s3RAD6IgnoreVHa" = internal constant { i32, i32, i32, i32, i32, i32, i32 } { i32 0, i32 trunc (i64 sub (i64 ptrtoint (%swift.type_descriptor* @"$s3RAD6IgnoreVMn" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 1) to i64)) to i32), i32 2, i32 trunc (i64 sub (i64 ptrtoint (<{ [2 x i8], i8 }>* @"symbolic Si" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 3) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes1AV5InnerC11extComputedSivpfa3RAD6IgnoreHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 4) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ i8, i32, [1 x i8], i8 }>* @"symbolic _____m 18runtime_attributes16WithExternalAttrV" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 5) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes16WithExternalAttrAaBVmvpfa3RAD6IgnoreHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 6) to i64)) to i32) }, section "__TEXT, __swift5_rattrs, regular", align 4
47+
// CHECK: @"$s3RAD6IgnoreVHa" = internal constant { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } { i32 0, i32 trunc (i64 sub (i64 ptrtoint (%swift.type_descriptor* @"$s3RAD6IgnoreVMn" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 1) to i64)) to i32), i32 5, i32 trunc (i64 sub (i64 ptrtoint (<{ [2 x i8], i8 }>* @"symbolic Si" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 3) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes1AV5InnerC11extComputedSivpfa3RAD6IgnoreHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 4) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ i8, i32, [1 x i8], i8 }>* @"symbolic _____m 18runtime_attributes16WithExternalAttrV" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 5) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes16WithExternalAttrAaBVmvpfa3RAD6IgnoreHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 6) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ i8, i32, [1 x i8], i8 }>* @"symbolic _____m 18runtime_attributes14TestInference1V" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 7) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes14TestInference1AaBVmvpfa3RAD6IgnoreHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 8) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ i8, i32, [1 x i8], i8 }>* @"symbolic _____m 18runtime_attributes14TestInference2C" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 9) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes14TestInference2AaBCmvpfa3RAD6IgnoreHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 10) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ i8, i32, [1 x i8], i8 }>* @"symbolic _____m 18runtime_attributes14TestInference3O" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 11) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes14TestInference3AaBOmvpfa3RAD6IgnoreHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD6IgnoreVHa", i32 0, i32 12) to i64)) to i32) }, section "__TEXT, __swift5_rattrs, regular", align 4
4548

4649
// CHECK: @"$s3RAD13TestAmbiguityVHa" = internal constant { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } { i32 0, i32 trunc (i64 sub (i64 ptrtoint (%swift.type_descriptor* @"$s3RAD13TestAmbiguityVMn" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 1) to i64)) to i32), i32 6, i32 trunc (i64 sub (i64 ptrtoint (<{ [4 x i8], i8 }>* @"symbolic ySic" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 3) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes4testyySicvpfa3RAD13TestAmbiguityHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 4) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ [4 x i8], i8 }>* @"symbolic ySSc" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 5) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes4testyySScvpfa3RAD13TestAmbiguityHF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 6) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ [4 x i8], i8, i32, [2 x i8], i8 }>* @"symbolic Siyc_____mc 18runtime_attributes15TestNoAmbiguityV" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 7) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes15TestNoAmbiguityV10testStaticSiycvpZfa3RAD0cE0HF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 8) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ [3 x i8], i8, i32, [2 x i8], i8 }>* @"symbolic yyc_____mc 18runtime_attributes15TestNoAmbiguityV" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 9) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes15TestNoAmbiguityV10testStaticyycvpZfa3RAD0cE0HF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 10) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ [8 x i8], i8, i32, [1 x i8], i8 }>* @"symbolic ySi_SStc_____c 18runtime_attributes15TestNoAmbiguityV" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 11) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes15TestNoAmbiguityV8testInstyySi_SStcvpfa3RAD0cE0HF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 12) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (<{ [8 x i8], i8, i32, [1 x i8], i8 }>* @"symbolic ySi_Sitc_____c 18runtime_attributes15TestNoAmbiguityV" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 13) to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (%swift.accessible_function* @"$s18runtime_attributes15TestNoAmbiguityV8testInstyySi_Sitcvpfa3RAD0cE0HF" to i64), i64 ptrtoint (i32* getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }, { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }* @"$s3RAD13TestAmbiguityVHa", i32 0, i32 14) to i64)) to i32) }, section "__TEXT, __swift5_rattrs, regular", align 4
4750

@@ -133,3 +136,10 @@ public struct TestNoAmbiguity {
133136
// CHECK-LABEL: define hidden swiftcc i8 @"$s18runtime_attributes15TestNoAmbiguityV8testInstyySi_Sitcvpfa3RAD0cE0"()
134137
@TestAmbiguity func testInst(_: Int, _: Int) {}
135138
}
139+
140+
// CHECK-LABEL: define hidden swiftcc i8 @"$s18runtime_attributes14TestInference1AaBVmvpfa3RAD6Ignore"()
141+
public struct TestInference1 : Ignored {}
142+
// CHECK-LABEL: define hidden swiftcc i8 @"$s18runtime_attributes14TestInference2AaBCmvpfa3RAD6Ignore"()
143+
public class TestInference2 : Ignored {}
144+
// CHECK-LABEL: define hidden swiftcc i8 @"$s18runtime_attributes14TestInference3AaBOmvpfa3RAD6Ignore"()
145+
public enum TestInference3 : Ignored {}

0 commit comments

Comments
 (0)