[Macros] Add support for explicit generic arguments of macros.

Enable type checking support for explicitly specifying generic arguments to
a macro, e.g., `#stringify<Double>(1 + 2)`. To do so, introduce a new
kind of constraint that performs explicit argument matching against the
generic parameters of a macro only after the overload is chosen.
This commit is contained in:
Doug Gregor
2022-11-18 11:41:21 -08:00
parent afbc4a5ffd
commit 8adee85cb6
8 changed files with 167 additions and 7 deletions

View File

@@ -5611,6 +5611,13 @@ private:
Type type1, Type type2, TypeMatchOptions flags,
ConstraintLocatorBuilder locator);
/// Simplify an explicit generic argument constraint by equating the
/// opened generic types of the bound left-hand type variable to the
/// pack type on the right-hand side.
SolutionKind simplifyExplicitGenericArgumentsConstraint(
Type type1, Type type2, TypeMatchOptions flags,
ConstraintLocatorBuilder locator);
public: // FIXME: Public for use by static functions.
/// Simplify a conversion constraint with a fix applied to it.
SolutionKind simplifyFixConstraint(ConstraintFix *fix, Type type1, Type type2,