Commit Graph

275 Commits

Author SHA1 Message Date
Doug Gregor
bae28971ac Push TypeResolutionOptions through TypeChecker::validateType()
Swift SVN r12581
2014-01-20 16:33:33 +00:00
Doug Gregor
da879baa12 Introduce a typed option set template, OptionSet.
Use it to replace the error-prone use of "unsigned" to pass flags
through type resolution.


Swift SVN r12580
2014-01-20 16:20:21 +00:00
Doug Gregor
5522627353 Push options through resolveType().
Swift SVN r12576
2014-01-20 15:43:43 +00:00
Doug Gregor
3495603472 Clean up the formation of lvalue constraints in the type checker, and assert that we don't get an lvalue-of-lvalue type.
Swift SVN r12286
2014-01-14 15:17:40 +00:00
Doug Gregor
5f1e886907 Wrap delegating initialization ('self.init' calls) in RebindSelfInConstructorExpr.
As with chaining initialization ('super.init' calls), wrapping the
delegating initialization in RebindSelfInConstructorExpr ensures that
'self' gets overwritten by the result of delegation.

Note that I'd much prefer that RebindSelfInConstructorExpr be
introduced by the type checker (not the parser). That cleanup will
follow.



Swift SVN r11932
2014-01-06 18:25:29 +00:00
Doug Gregor
fc00bf6076 Parsing and semantic analysis for delegating initializers.
Swift SVN r11921
2014-01-06 16:33:08 +00:00
Chris Lattner
fae3a61bd5 Pull construction of locators out to their own source lines, to follow the dominant style. NFC.
Swift SVN r11873
2014-01-03 22:50:37 +00:00
Chris Lattner
c73bfe2530 rework sema and silgen of SuperRefExpr. The most notable change is that it
is no longer an lvalue, since it doesn't make sense to assign to super.

This eliminates a bunch of special cases and simplifies things.



Swift SVN r11803
2014-01-01 22:51:10 +00:00
Chris Lattner
9427c4b3b8 silence "not covered" warnings that I missed.
Swift SVN r11776
2013-12-31 21:38:32 +00:00
Chris Lattner
9ae289de46 Drive the semantic wedge harder into lvalues. Now, instead of having one LValueType
with qualifiers on it, we have two distinct types:
 - LValueType(T) aka @lvalue T, which is used for mutable values on the LHS of an
   assignment in the typechecker.
 - InOutType(T) aka @inout T, which is used for @inout arguments, and the implicit
   @inout self argument of mutable methods on value types.  This type is also used
   at the SIL level for address types.

While I detangled a number of cases that were checking for LValueType (without checking
qualifiers) and only meant @inout or @lvalue, there is more to be done here.  Notably,
getRValueType() still strips @inout, which is totally and unbearably wrong.



Swift SVN r11727
2013-12-29 22:23:11 +00:00
Chris Lattner
78f765f5f8 simplify adjustLValueForReference: now it *only* changes @inout arguments to be
implicit lvalues when referenced, so it can be simplified.


Swift SVN r11709
2013-12-29 04:52:58 +00:00
Chris Lattner
18a9193452 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
2013-12-29 04:38:26 +00:00
Chris Lattner
d3c91387e9 Substantially simplify the API to LValueType now that nonsettable is gone.
Swift SVN r11703
2013-12-28 22:48:44 +00:00
Chris Lattner
5a053ac85a - fix the ASTDumper to propertly dump closure_expr's.
- mark closure arguments (both explicit and $0's) as immutable
- Adjust the stdlib (one place) and some tests to cope with this.
- Remove some special case logic in sema for lvalue qualifying
  anonymous closure exprs, which is now the wrong thing to do.




Swift SVN r11674
2013-12-27 21:01:00 +00:00
Chris Lattner
a792065c57 continue rvalue world domination. Switch get-only subscript expressions to produce
rvalues instead of non-modifiable lvalues.


Swift SVN r11634
2013-12-25 21:34:52 +00:00
Chris Lattner
b29748a6be remove the ASTContext argument from Type::transform,
(various) FunctionType::get's, ArrayType::get,
ArraySliceType::get, OptionalType::get, and a few
other places.

There is more to be done here, but this is all I plan to do
for now.


Swift SVN r11497
2013-12-20 02:23:21 +00:00
Chris Lattner
1472e4d914 Remove the ASTContext argument from LValueType::get(). It is already
only two loads away from the type argument passed in.



Swift SVN r11496
2013-12-20 01:28:50 +00:00
Joe Groff
017440165e Fix the weird capitalization of MetaTypeType.
Swift SVN r11475
2013-12-19 18:43:08 +00:00
Doug Gregor
3825df464a Allow delayed-identifier expressions (.Foo) to meaningfully produce lvalues.
Swift SVN r11384
2013-12-17 17:03:16 +00:00
Doug Gregor
1d12c5352c Check a complete array-new expression within a single constraint system.
Fixes <rdar://problem/15653973>.


Swift SVN r11262
2013-12-13 19:16:19 +00:00
Doug Gregor
02565748b7 Fold checking of the subexpression of 'is' into the enclosing constraint system.
Similar to r11235, but for 'is' expressions. QoI suffers somewhat here
because (1) we don't have an easy way to specialize the diagnostic,
and (2) we can't fix up the broken constraint system when we hit a
problem.


Swift SVN r11241
2013-12-13 05:00:06 +00:00
Doug Gregor
74784f89c4 Fold checking of the subexpression in "x as T" into the enclosing constraint system.
Previously, we had an artificial separation between the subexpression
"x" and the context of the expression "x as T". This breaks down when
the subexpression includes a reference to an anonymous closure
argument (e.g., $0) from a single-expression closure. By merging the
systems, we fix the crasher (<rdar://problem/15633178>) and allow
improved type inference for these expressions.



Swift SVN r11235
2013-12-13 04:30:20 +00:00
Chris Lattner
39224db6a9 remove the ZeroValueExpr AST node.
Swift SVN r11048
2013-12-09 23:16:14 +00:00
Doug Gregor
5bb053c0dd Fix renamed file names
Swift SVN r11017
2013-12-09 14:20:33 +00:00
Doug Gregor
ee545e9f68 Rename TypeCheckConstraintsFoo.cpp to CSFoo.cpp.
It's more idiomatic and easier to type.


Swift SVN r11015
2013-12-09 14:09:54 +00:00