Commit Graph

28619 Commits

Author SHA1 Message Date
Chris Lattner
e89a22ada9 now that typeCheckExpression is our main entry point for expr type checking,
have it do "completeness" checking (also fixing some regressions I introduced
along the way).  Exprs are now modularly checked, woo!



Swift SVN r633
2011-08-26 20:57:02 +00:00
Chris Lattner
161b2c83d5 make typeCheckExpression take an optional "convert to type" which comes from context,
simplifying a bunch of code.


Swift SVN r632
2011-08-26 20:53:09 +00:00
Chris Lattner
a0a7c2ac36 fix the expression type checker to not recurse down into statements, resolving some type checking issues.
Swift SVN r631
2011-08-26 00:48:33 +00:00
Chris Lattner
d7c0076b2f finish up sema of 'return', force converting the returned expression to the return type of the enclosing func.
Swift SVN r629
2011-08-26 00:24:35 +00:00
Chris Lattner
e0ce01906e split type validation out to its own .cpp file.
Swift SVN r628
2011-08-26 00:11:24 +00:00
Chris Lattner
2020470195 rip statement checkout out of the expr checker, allowing us to
enable checking of top level var decls etc.


Swift SVN r625
2011-08-25 23:33:30 +00:00
Chris Lattner
cbd84c3f73 split statement type checking out to its own file, detangling some stuff from Expr checking.
More to be done.


Swift SVN r624
2011-08-25 19:58:04 +00:00
Chris Lattner
2711ad03c9 now that WalkOrder is in a common header, move the WalkStmt to be a
Stmt method, rename it to just 'walk' to follow the naming convention,
and give it an accurate doc comment for good measure.


Swift SVN r622
2011-08-25 18:24:54 +00:00
Chris Lattner
cb59d9c926 split the walkorder enum out to its own header file. This is a silly waste of
a file, but is needed to share it between two other heads.  Header files seem
so baroque.


Swift SVN r621
2011-08-25 18:18:22 +00:00
Chris Lattner
26cee15cf3 Switch expr walking functionality to take blocks instead of function pointer + void*.
Swift SVN r602
2011-08-25 00:51:31 +00:00
Chris Lattner
ea63f11a7b move expression type coercion out to TypeCheckCoercion,
and change terminology to follow that which is understood by
other people.


Swift SVN r590
2011-08-23 19:53:11 +00:00
Chris Lattner
43aae84ae5 pull SemaTupleExpr into the TypeChecker class.
Swift SVN r589
2011-08-23 19:48:37 +00:00
Chris Lattner
aae5e303c1 inline SemaDeclRefExpr into its only call site.
Swift SVN r588
2011-08-23 19:47:06 +00:00
Chris Lattner
dfbb6b1c91 move "bottom-up" type checking into TypeCheckExpr.cpp, and
change terminology to follow directionality that other people
find more natural.


Swift SVN r587
2011-08-23 19:45:31 +00:00
Chris Lattner
63cd4a9566 sketch out the new type checking organization.
Swift SVN r586
2011-08-23 19:20:22 +00:00
Chris Lattner
ad0852d9c9 move the definition of the TypeChecker class out to its own private
header, in preparation for splitting up TypeChecking.cpp.


Swift SVN r585
2011-08-23 00:50:04 +00:00
Chris Lattner
c827cc11a0 tidy up visitor, UnresolvedDotExpr base cannot be null since John's rework.
Swift SVN r584
2011-08-23 00:39:47 +00:00
Chris Lattner
bd357f9051 unify the binary operator logic too.
Swift SVN r583
2011-08-22 23:02:36 +00:00
Chris Lattner
49dd631c12 unify the UnaryExpr and CallExpr type checking logic.
Swift SVN r582
2011-08-22 22:58:07 +00:00
Chris Lattner
3e02267edf hoist the argument expression of Call/Unary/Binary up to ApplyExpr.
Swift SVN r581
2011-08-22 22:45:02 +00:00
Chris Lattner
035b65d407 change the representation of BinaryExpr to use an implicit tuple
to bind its LHS/RHS together, making it more similar to other ApplyExprs.


Swift SVN r580
2011-08-22 22:42:12 +00:00
Chris Lattner
b04c19e647 introduce a enw AST/AST.h umbrella header and use it to
simplify #includes.



Swift SVN r578
2011-08-22 21:02:44 +00:00
Chris Lattner
f03486e991 diagnose a bunch of problem cases with operators.
Swift SVN r575
2011-08-20 01:29:00 +00:00
Chris Lattner
28f05f0348 add parser and sema support for user defined unary operators.
Swift SVN r572
2011-08-20 00:27:11 +00:00
Chris Lattner
4c9b8ecf11 add ast and sema support for unary operators. We need some serious AST refactoring
to unify our representation of calls, which I'll do later.


Swift SVN r570
2011-08-19 22:40:26 +00:00
Chris Lattner
92051fd98e add a new Subsystems.h file to hold the entrypoints for various subsystems,
instead of smashing them into Parser.h, resolving some FIXME's.



Swift SVN r556
2011-08-13 22:43:17 +00:00
Chris Lattner
73a3f9d888 fix clients to not poke the Parser class directly.
Swift SVN r555
2011-08-13 22:38:20 +00:00
Chris Lattner
33f774f9b7 Rearrange a bunch of code for better layering: instead of Parser depending on Sema,
just move the Sema code into the Parser library.  There is no way to use one without
the other.  The library formerly known as Sema will get renamed.


Swift SVN r542
2011-08-13 21:06:10 +00:00
Chris Lattner
b40d2ce29e fix naming convention violations.
Swift SVN r536
2011-08-12 22:52:33 +00:00
Chris Lattner
2689efa63b have the error type squeltch type checking.
Swift SVN r535
2011-08-12 22:46:01 +00:00
Chris Lattner
0dcbc8a3e8 remove some code that is unreachable now that sequence exprs go away reliably.
Swift SVN r534
2011-08-12 22:26:29 +00:00
Chris Lattner
4e074b6bb0 fix some busted logic handling overload resolution, producing
a correct (but poor QoI) error about no candidates an ambiguity.


Swift SVN r533
2011-08-12 22:03:05 +00:00
Chris Lattner
0015b823fb When type checking :foo(), we should defer type checking for
"root to leaf" type checking instead of emitting an error.  This fixes
the test breakage from the big rework patch.


Swift SVN r531
2011-08-12 21:51:11 +00:00
Chris Lattner
09da5ddc0b restructure code for readability, no functionality change.
Swift SVN r530
2011-08-12 21:48:28 +00:00
Chris Lattner
b8fd157450 rip out the dead "isPrecededByIdentifier" logic from the AST and Lexer.
Swift SVN r529
2011-08-12 21:36:25 +00:00
John McCall
ddd134854e Rename ApplyExpr to CallExpr and change the signature of SemaCallExpr.
Swift SVN r523
2011-08-12 17:31:14 +00:00
John McCall
51a01a0ee5 All the excess-exprs stuff is dead code, now that the parser decides
statement boundaries correctly.



Swift SVN r519
2011-08-12 06:19:44 +00:00
Chris Lattner
4814530f79 rework validateType to be more conventional: not updating types in place.
Swift SVN r516
2011-08-12 05:54:44 +00:00
John McCall
9f2ca5e4cc Remove juxtaposition handling from the type-checker and put it
in the parser.  Implement the grammar which permits this.
Enforce that binary operators have to, well, operators.



Swift SVN r515
2011-08-12 05:49:30 +00:00
Chris Lattner
1dc200c973 introduce an official ErrorType. This is to be used when a type is incorrectly
constructed.  When put on a decl, this should cause all uses of the decl to 
collapse away into badness during type checking.


Swift SVN r514
2011-08-12 05:42:20 +00:00
Chris Lattner
10f5c2fc66 remove the UnresolvedType, representing it with a null Type() instead. There is no need to
have two different ways to represent the same thing.  This has the pleasant bonus that stuff
crashes when you do things with unresolved types.


Swift SVN r513
2011-08-12 05:19:52 +00:00
Chris Lattner
452308129e fix a case where Sema installed a non-null type. This isn't needed, we like null types
coming out of the parser.


Swift SVN r512
2011-08-12 04:57:50 +00:00
Chris Lattner
9e6817b3cd implement lexer, parser, and dox support for while loops, everything is hooked up now.
Swift SVN r502
2011-08-11 20:47:33 +00:00
Chris Lattner
ce6f6a83cd add AST support for WhileStmt. This isn't important, but is easy to add.
Swift SVN r501
2011-08-11 20:33:34 +00:00
Chris Lattner
433d6de807 implement AST and parser support for 'return'. We're still not doing a conversion
to a return type yet though.  We happily diagnose thigns like this as an error:

func foo() -> int {
  return 4 5
}



Swift SVN r493
2011-08-03 23:19:24 +00:00
Chris Lattner
ba773ca617 make unbound sequences of expressions that are not in a BraceStmt be an error.
This makes (0 1) an error, since 0 is dead.



Swift SVN r489
2011-08-03 22:18:14 +00:00
Chris Lattner
6e872fe562 when type checking of a sequence expr has completed, if that sequence expr is in
a bracestmt context, inline the sequence into the brace.  No particular
behavior change other than an adapted AST.


Swift SVN r488
2011-08-03 21:58:32 +00:00
Chris Lattner
c86e786ab5 switch langref to new func syntax, switch implementation to use FuncExpr instead of LambdaExpr.
Swift SVN r487
2011-08-03 00:32:15 +00:00
Chris Lattner
0265e3cbd1 make 'else if' a special case, disallowing things like "else ;".
Swift SVN r482
2011-08-02 21:31:31 +00:00
Chris Lattner
350b89e6e4 Represent assignments as their own AssignStmt, preserving the model we had
before, but removing the hack where we'd represent them as a binary operator
with a null operator function.  We still have no clear semantics for what 
is valid or not.



Swift SVN r478
2011-08-01 17:45:21 +00:00