swift
67308e68 - Sema: Fix crash-on-invalid with incorrect use of variadic generic type

Commit
1 year ago
Sema: Fix crash-on-invalid with incorrect use of variadic generic type Applying generic arguments to a variadic generic type uses the PackMatcher to build a mapping between generic parameters and arguments. The PackMatcher is symmetric, so there was an unexpected failure mode that wasn't handled: if the variadic generic type had some non-pack parameters, but the argument list was a single pack expansion type, the match would succeed, grouping all of the generic parameters into a single match. This is non-sensical, so we need to explicitly check for this case and diagnose it. This requires a new diagnostic, since otherwise the general diagnostic we emit for variadic generic type mismatches doesn't make sense, since it's complaining about there being too few generic parameters. Fixes rdar://116713961 / https://github.com/apple/swift/issues/69012.
Author
Committer
Parents
Loading