Revert r1144, r1145, and r1146. These changes (which removed ParenType

in favor of a single-element non-canonical TupleType) broke the type
system, in that supposed sugar (the TupleType) supported a different
set of operations from the canonical type.  For example, a
single-element unlabelled tuple type supports elementwise projection
(foo.$0), but the underlying element does not (or supports it
differently).

The IR-gen failure was due to a very related problem:  IR-gen
was not updated to reflect that a single unlabelled tuple element
is the same type as its element type, and therefore it was giving
different representations to these types ({ %foo } and %foo,
respectively), which broke widespread assumptions.

The removal of ParenType was done in pursuit of an AST invariant
that's not actually particularly interesting in the first place
and which, furthermore, is problematic to attain.

Swift SVN r1182
This commit is contained in:
John McCall
2012-03-11 09:15:21 +00:00
parent b8b1694564
commit b2a2027a43
8 changed files with 72 additions and 36 deletions

View File

@@ -36,6 +36,9 @@ static bool checkFullyTyped(Parser &P, Type type) {
case TypeKind::Dependent:
return false;
case TypeKind::Paren:
return checkFullyTyped(P, cast<ParenType>(type)->getUnderlyingType());
case TypeKind::LValue:
return checkFullyTyped(P, cast<LValueType>(type)->getObjectType());