Commit Graph

22610 Commits

Author SHA1 Message Date
Chris Lattner
cb1d2cacbe implement a new CanType subclass of Type, for use when we known that we have a canonical type.
Unlike Type, it implements equality operators.  It is returned by Type->getCanonicalType().

This adopts it in the minimal places required to get the build to work, it would also be nice
to switch IRGen to canonical types and use it there.


Swift SVN r1298
2012-03-29 20:33:20 +00:00
Doug Gregor
c76edd6643 Remove Expr::setDependentType(); it's not really documenting anything,
and with structured dependent types, many more setType() calls
actually would have to be setDependentType() to be documenting.


Swift SVN r1297
2012-03-29 18:57:18 +00:00
Doug Gregor
f370accf59 Introduce the notion of structured dependent types, such as a tuple
type with one or more elements of dependent type. Previously, an
expression such as (x, 5) would have the (unstructured) dependent
type, limiting our ability to type-check the subexpression 'x'
early. Now, if 'x' has type 'int' (for example), this expression will
now have the type (int, <<unstructured dependent type>>).

Extend coercion of a tuple to tuple type to handle coercion to
(structured) dependent tuple types, coercing element-by-element. This
code is very lightly tested and may still need to be restructured.




Swift SVN r1294
2012-03-29 16:26:04 +00:00
Doug Gregor
4cc616f2be Rename the DependentType class to UnstructuredDependentType, because
this type is only going to cover dependent types for which there is
absolutely no structure. Still no functionality change.


Swift SVN r1292
2012-03-29 14:14:48 +00:00
Doug Gregor
22371781a5 Introduce TypeBase::isDependentType(), and use it rather than checks
against the DependentType class. No functionality change.


Swift SVN r1291
2012-03-29 14:03:57 +00:00
Eli Friedman
b65f969193 Replace ":foo" syntax for oneof members with ".foo".
Swift SVN r1288
2012-03-29 01:58:55 +00:00
Eli Friedman
29f3fca950 First iteration of CaptureAnalysis.
Swift SVN r1284
2012-03-29 00:24:03 +00:00
Doug Gregor
e17398510a Re-pack a few Expr nodes for the inevitable switch to 32-bit source
locations.


Swift SVN r1283
2012-03-28 23:54:38 +00:00
Doug Gregor
5fffa75e7b Remove empty throw specifications from all of the overloaded new operators; reduces code size by 8k
Swift SVN r1282
2012-03-28 22:00:02 +00:00
Doug Gregor
c6db376e7c Remove empty exception-specification from operator new; it pessimizes callers
Swift SVN r1281
2012-03-28 18:07:29 +00:00
Doug Gregor
8f8ae8a77c Unbreak CMake build.
Swift SVN r1280
2012-03-28 16:49:40 +00:00
Eli Friedman
09ba5b54b5 Fix uninitialized members in DeclAttributes.
Swift SVN r1277
2012-03-28 00:12:22 +00:00
Eli Friedman
d2bbf81245 Zap AnonClosureArgExpr.
Swift SVN r1269
2012-03-27 01:03:15 +00:00
John McCall
95f97e89ea The DeclRetTy of an ASTVisitor is the third argument.
Swift SVN r1266
2012-03-26 06:08:16 +00:00
John McCall
2cbf897b73 Convenience methods for querying whether an l-value type is
qualified 'explicit' or 'heap' or whatever.

Swift SVN r1263
2012-03-26 03:26:13 +00:00
Chris Lattner
f78a4e0be5 implement a bit of context sensitive overload set resolution, resolving some fixme's
in name-binding and making progress towards 11088443


Swift SVN r1256
2012-03-25 03:28:17 +00:00
Eli Friedman
80b55617ba Start of computing captures for CapturingExprs in the AST; only works for ExplicitClosureExprs so far. Per previous discussion, anything which can be captured goes through the relevant codepath in Parser::actOnIdentifierExpr.
Swift SVN r1251
2012-03-22 02:37:57 +00:00
Eli Friedman
ea17adc3ec Completely switch over IRGen for closures to use the standard prologue/epilogue emission.
Swift SVN r1250
2012-03-22 01:04:05 +00:00
Eli Friedman
61c2a9ea18 Fix error-checking for UnresolvedMemberExpr coercion. Some minor improvements for coercion and lvalues. Converting dependent types still has a lot of issues.
Swift SVN r1249
2012-03-21 05:13:40 +00:00
Eli Friedman
fdc45c7611 Store the VarDecls and Patterns for AnonClosureArgExpr and ExplicitClosureExpr in the AST.
It might be possible to save some memory by breaking the AnonClosureArgExpr linked list during type-checking... not sure if that's worthwhile.



Swift SVN r1248
2012-03-20 21:43:36 +00:00
Eli Friedman
8ece7c0103 Fix a few minor typos.
Swift SVN r1241
2012-03-20 01:23:44 +00:00
Eli Friedman
d39a7abe36 Implement CapturingExpr. In addition to unifying the hierarchy between FuncExpr and ClosureExpr, this introduces a DeclContext for ClosureExprs. <rdar://problem/11076715>
Swift SVN r1240
2012-03-20 01:08:04 +00:00
John McCall
1a4b945a14 Flag in a ValueDecl whether it's ever been used as an
l-value or a heap l-value, except to immediate convert
it to an r-value or a non-heap l-value.

Swift SVN r1237
2012-03-19 08:28:42 +00:00
John McCall
2fd608ae4d Add basic parsing and type-system support for the byref(heap)
qualifier, making sure that variables end up so-qualified by
default.  Add a RequalifyExpr to capture the act of adding
qualifiers (to form a supertype) to an l-value.

Swift SVN r1236
2012-03-19 06:55:23 +00:00
Chris Lattner
6185ab6d50 move getImplicitThisDecl to FuncDecl where the other 'this' handling stuff goes.
Swift SVN r1233
2012-03-19 05:43:20 +00:00
Chris Lattner
4e4c1bf417 rename DotSyntaxPlusFuncUseExpr -> DotSyntaxBaseIgnoredExpr
to properly represent its newly generalized role.  It is formed
for things like "swift.print" where swift is a module type and is
evaluated and ignored.


Swift SVN r1230
2012-03-19 05:23:39 +00:00
Chris Lattner
e7cd357065 reimplement TypeChecker::semaUnresolvedDotExpr in terms of the new
MemberLookup class.


Swift SVN r1229
2012-03-19 05:16:19 +00:00
Chris Lattner
1884e4943f refactor some code out of Sema into AST.
Swift SVN r1225
2012-03-17 23:07:00 +00:00
John McCall
1f118dbda6 Basic support for Builtin.ObjectPointer as a completely
opaque type.  Also some rudimentary support for retain/release.

Swift SVN r1214
2012-03-16 09:26:32 +00:00
Eli Friedman
595676abf7 Limit the number of potential getLogicValue() calls for a conditional to 2. Per Chris's comments.
Swift SVN r1208
2012-03-13 21:58:53 +00:00
Chris Lattner
11f3d2bcae implement a method to get the 'this' argument for a FuncExpr if there is one.
Swift SVN r1204
2012-03-11 23:35:48 +00:00
Chris Lattner
f3b62f09c7 enhance astwalker to allow implementations to control pre/post-order visiting of decls.
Swift SVN r1203
2012-03-11 21:26:02 +00:00
Chris Lattner
0cccfe9299 rename the Walker class to ASTWalker to match ASTVisitor.
Swift SVN r1201
2012-03-11 16:28:50 +00:00
Chris Lattner
0340dd17d0 rename Walk.h to Walker.h to match the name of the class it declares.
Swift SVN r1200
2012-03-11 16:22:26 +00:00
Chris Lattner
3b0db63f85 introduce ImplicitThisTupleElementExpr, progress towards 10682135.
IRGen should really use visitors for expr emission...


Swift SVN r1199
2012-03-11 15:02:16 +00:00
Chris Lattner
7c2da880e1 Put 'Expr' in the right place.
Swift SVN r1197
2012-03-11 14:54:43 +00:00
Chris Lattner
d75f76a096 split TupleElementExpr into an abstract TupleElementExpr class and a concrete
SyntacticTupleElementExpr class.  One step towards resolving rdar://10682135.


Swift SVN r1195
2012-03-11 14:48:04 +00:00
Chris Lattner
672801980d enhance ASTVisitor for expressions to automatically synthesize visit methods for nodes
that are not handled by a visitor.  Make their implementation chain up to a parent node's
implementation.  For example, a (silly) visitor could choose to just implement visitExpr
and get all nodes.


Swift SVN r1194
2012-03-11 14:47:16 +00:00
Chris Lattner
e3f6f4b87a Convert test cases to use the new auto_closure attribute,
inform conversion ranking about auto_closure, and rip out the
CR_AutoClosure implicit conversion.  Our conversion ranking is
now completely trivial: we either have an identity conversion
or an invalid one - no crazy implicit conversions (still have
tuple shuffles etc though).


Swift SVN r1192
2012-03-11 14:08:40 +00:00
Chris Lattner
71f351e0b6 fix the autoclosure bit to be properly canonicalized and preserved when building functiontypes.
Swift SVN r1190
2012-03-11 14:00:05 +00:00
Chris Lattner
cd108afcce reject auto_closure on decls.
Swift SVN r1189
2012-03-11 13:23:15 +00:00
Chris Lattner
494aa187fa prune #include
Swift SVN r1188
2012-03-11 13:15:47 +00:00
Chris Lattner
145d926548 Perform sema of FunctionType's that have auto_closure behavior, building a bit in FunctionType.
Swift SVN r1187
2012-03-11 13:15:03 +00:00
Chris Lattner
01b184acab parse the auto_closure attribute.
Swift SVN r1186
2012-03-11 12:44:19 +00:00
John McCall
ed436cf3ff Forbid the declaration of a custom unary '&' operator.
Swift SVN r1184
2012-03-11 09:15:28 +00:00
John McCall
b2a2027a43 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
2012-03-11 09:15:21 +00:00
John McCall
b8b1694564 Complain about file names that aren't valid identifiers.
When we divide the world into scripts and modules, this
won't matter for the former.  Recognize <stdin> as a
special case;  it should instead just always be a script.
Fixes rdar://problem/10986311.

Swift SVN r1181
2012-03-11 09:15:17 +00:00
Chris Lattner
9e873372d9 move attributes out to their own .def file, to match expr's and stmt's.
Part of rdar://10719165 - Clean up attributes code


Swift SVN r1179
2012-03-11 01:39:11 +00:00
Eli Friedman
18016053df Add basic infinite loop checking for conversion for conditional, per John's comment. There's probably some way I can't think of off the top of my head to write an infinite loop this doesn't catch, but it should be enough to catch obvious mistakes.
Swift SVN r1175
2012-03-10 00:26:36 +00:00
Eli Friedman
eada7c6558 Make sure we catch 0x/0o/0b which isn't followed by an appropriate digit. Per Chris's comment.
Swift SVN r1174
2012-03-10 00:12:43 +00:00