Skip to content

Commit d91b9fc

Browse files
author
Greg Titus
committed
Add exception to allow macro decls to have arbitrary specializations
1 parent f6a44cb commit d91b9fc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14046,6 +14046,11 @@ ConstraintSystem::simplifyExplicitGenericArgumentsConstraint(
1404614046

1404714047
auto genericParams = getGenericParams(decl);
1404814048
if (!decl->getAsGenericContext() || !genericParams) {
14049+
// Allow Macros to have specializations that we don't think they need.
14050+
if (isa<MacroDecl>(decl)) {
14051+
return SolutionKind::Solved;
14052+
}
14053+
1404914054
return recordFix(AllowConcreteTypeSpecialization::create(
1405014055
*this, type1, getConstraintLocator(locator)))
1405114056
? SolutionKind::Error

test/Macros/attached_macros_diags.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,8 @@ struct TestMacroArgs {
6969
// expected-error@-1{{missing argument for parameter #1 in macro expansion}}
7070

7171
@m3(message: #stringify(Nested.x).1) struct Args8 {}
72+
73+
// Allow macros to have arbitrary generic specialization lists
74+
// https://github.com/swiftlang/swift/issues/75500
75+
@m1<UInt> struct Args9 {}
7276
}

0 commit comments

Comments
 (0)