Ensure that the correct information whether an init-capture of a lambda
is passed by reference or by copy. This information is already computed
and has to be passed to the place where NewInitCaptureType is
created.
Before this fix it has been checked whether the VarDecl is a reference
type. This doesn't work for packed expansions, as the information
whether it is passed by reference or by copy is stored at the pattern of
a PackExpansionType and not at the type itself.
However, as the information has been already computed, we just have to
pass it.
Add test that lambda captures with var decls which are reference types
are created in the AST.
Fixes #49266
NIT 1: naming, this should be in UpperCamelCase
NIT 2: maybe rename to ByRef? It might be a bit confusing to talk about types here as the idea is to actually pass information about the syntax. Types can be inspected by looking at Var.