Redesign how @inout propagation works in the typechecker:

- Switch all the 'self' mutable arguments to take self as @inout, since
   binding methods to uncurried functions expose them as such.
 - Eliminate the subtype relationship between @inout and @inout(implicit),
   which means that we eliminate all sorts of weird cases where they get
   dropped (see the updated testcases).
 - Eliminate the logic in adjustLValueForReference that walks through functions
   converting @inout to @inout(implicit) in strange cases.
 - Introduce a new set of type checker constraints and conversion kinds to properly
   handle assignment operators: when rebound or curried, their input/result argument
   is exposed as @inout and requires an explicit &.  When applied directly (e.g. 
   as ++i), they get an implicit AddressOfExpr to bind the mutated lvalue as an
   @inout argument.

Overall, the short term effect of this is to fix a few old bugs handling lvalues.
The long term effect is to drive a larger wedge between implicit and explicit 
lvalues.


Swift SVN r11708
This commit is contained in:
Chris Lattner
2013-12-29 04:38:26 +00:00
parent 60cfcf74e9
commit 18a9193452
12 changed files with 109 additions and 84 deletions

View File

@@ -49,6 +49,7 @@ Constraint::Constraint(ConstraintKind Kind, Type First, Type Second,
case ConstraintKind::TrivialSubtype:
case ConstraintKind::Subtype:
case ConstraintKind::Conversion:
case ConstraintKind::OperatorConversion:
case ConstraintKind::Construction:
case ConstraintKind::ConformsTo:
case ConstraintKind::CheckedCast:
@@ -154,6 +155,7 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm) const {
case ConstraintKind::TrivialSubtype: Out << " <t "; break;
case ConstraintKind::Subtype: Out << " < "; break;
case ConstraintKind::Conversion: Out << " <c "; break;
case ConstraintKind::OperatorConversion: Out << " <oc "; break;
case ConstraintKind::Construction: Out << " <C "; break;
case ConstraintKind::ConformsTo: Out << " conforms to "; break;
case ConstraintKind::CheckedCast: Out << " checked cast to "; break;
@@ -261,6 +263,7 @@ gatherReferencedTypeVars(Constraint *constraint,
case ConstraintKind::Bind:
case ConstraintKind::Construction:
case ConstraintKind::Conversion:
case ConstraintKind::OperatorConversion:
case ConstraintKind::CheckedCast:
case ConstraintKind::Equal:
case ConstraintKind::Subtype: