The SILGen testsuite consists of valid Swift code covering most language
features. We use these tests to verify that no unknown nodes are in the
file's libSyntax tree. That way we will (hopefully) catch any future
changes or additions to the language which are not implemented in
libSyntax.
Swift admits implicit conversions between tuple types to
introduce and eliminate argument labels, and re-order
argument labels. These are expressed as TupleShuffleExpr
in the AST.
SILGen has two different code paths for lowering TupleShuffleExpr,
which is also used for varargs and default arguments in call
argument emission.
These two code paths support different subsets of TupleShuffleExpr;
neither one supports the full generality of the other, but there
is some overlap.
Work around the damage by routing the two different "kinds" of
TupleShuffleExprs to the correct place in argument emission.
The next incremental step here would be to refactor ArgEmitter to
make it usable when lowering SubscriptExpr; then the RValueEmitter's
support for varargs in TupleShuffleExpr can go away. Once that's
done we can split off an ArgumentExpr from TupleShuffleExpr, and
in the fullness of time, fold ArgumentExpr into ApplyExpr.
At that point this dark corner of the AST will start to be sane...
Fixes <https://bugs.swift.org/browse/SR-2887>.