We used to disallow pack expansions in generic argument lists of
protocols, but allow them for all other nominal types. However,
we only actually checked that the pack expansions match up if
the type itself was variadic.
Fix this by repurposing Context::ProtocolGenericArgument into
Context::ScalarGenericArgument, and using that when the type does
not have a parameter pack.
Context::GenericArgument is now Context::VariadicGenericArgument,
and we only use it if the type has a parameter pack, in which case
we use the PackMatcher, so any pack expansions in the wrong place
are caught there.
Fixes rdar://116716014 and https://github.com/apple/swift/issues/69088.
We already had a separate TypeResolverContext::ProtocolGenericArgument that
did not allow PackExpansionTypes, but it was never used.
Fixes rdar://problem/115538574.