Commit Graph

28404 Commits

Author SHA1 Message Date
Chris Lattner
85579ef131 Inline a bunch of trivial SemaExpr routines into parser. No need for the additional indirection/layering.
Swift SVN r342
2011-04-04 23:41:44 +00:00
Chris Lattner
5e2346492e Implement basic "dot syntax" for applying functions to values. size.area now applies size to area when area is defined as a global function.
Swift SVN r341
2011-04-02 23:10:55 +00:00
Chris Lattner
e55e5ca594 Improve error message.
Swift SVN r340
2011-04-02 22:53:53 +00:00
Chris Lattner
7530ec988c Add a error to reject foo() when foo is not a function type. Previously we allowed it because these are two valid top-level values, but we now reject them because they are almost certainly a bug. This can be disabled by putting a space between them if this is useful for some reason.
Swift SVN r339
2011-03-27 02:56:47 +00:00
Chris Lattner
866a5fdfe3 Minor tidying.
Swift SVN r338
2011-03-27 00:30:44 +00:00
Chris Lattner
85f67d0fc6 NameBinder shouldn't create exprs, it should return decls.
Swift SVN r337
2011-03-27 00:30:24 +00:00
Chris Lattner
d3201b3097 improve diagnostic.
Swift SVN r335
2011-03-26 23:12:54 +00:00
Chris Lattner
ed7b06c6ff Move semantic analysis of scoped identifiers (x::a) to typechecking, allowing forward referencing of types. This introduces a new UnresolvedScopedIdentifierExpr node to represent the unresolved form.
Swift SVN r334
2011-03-26 22:35:05 +00:00
Chris Lattner
eb9d1353d2 Allow name binding to bind to struct elements.
Swift SVN r332
2011-03-23 06:36:01 +00:00
Chris Lattner
b1ea095995 Factor a OneOf predicate into a helper method.
Swift SVN r331
2011-03-23 06:28:09 +00:00
Chris Lattner
c9ee19e269 Implement parser, sema, doc, and name lookup support for refined import declarations. You can still only do top level references, but that's because we don't have namespaces or anything else interesting yet.
This allows "import swift.int" for example. 

Swift SVN r329
2011-03-23 05:18:29 +00:00
Chris Lattner
2205513c45 Add a comment acknowledging that conversions are ambiguous and give an example. Simplify some code.
Swift SVN r328
2011-03-23 04:50:15 +00:00
Chris Lattner
2595be1ffa Clean up when type verification fails. This fixes the last testsuite failure! woot.
Swift SVN r327
2011-03-22 22:17:31 +00:00
Chris Lattner
828deb94ba improve wording of a diagnostic.
Swift SVN r326
2011-03-22 22:11:34 +00:00
Chris Lattner
7a04188335 Improve location info and some other diagnostics in a couple cases.
Swift SVN r325
2011-03-22 22:09:22 +00:00
Chris Lattner
8d2e911ba1 Make the type conversion errors *much* more specific, useful, and non-redundant.
Swift SVN r324
2011-03-22 22:03:56 +00:00
Chris Lattner
89a52ec1a1 Fix a crash on invalid where we didn't discard a munged subexpression tree.
Swift SVN r323
2011-03-22 21:36:06 +00:00
Chris Lattner
80b293cda6 Eliminate ConversionReason by having convertToType generate an error and the caller generate a note.
Swift SVN r322
2011-03-22 21:22:58 +00:00
Chris Lattner
72009397d6 Move type conversion routines into SemaCoerceBottomUp.
Swift SVN r321
2011-03-22 06:52:00 +00:00
Chris Lattner
c45bfcff0a Constant prop the IgnoreNonDecls argument to convertToType to be false since it is at all callsites.
Swift SVN r320
2011-03-22 06:44:08 +00:00
Chris Lattner
8c06074e98 rearrange a ton of code in TypeCHecking.cpp
Swift SVN r319
2011-03-22 06:42:30 +00:00
Chris Lattner
cf836f7446 Eliminate a getAs<> by not discarding type info.
Swift SVN r318
2011-03-22 06:30:37 +00:00
Chris Lattner
29c2cd0ea2 Rearrange a bunch of type checking conversion code to be forceful and not tolerate failure. Get rid of "try this, then this, then this" sort of conversion checking.
Swift SVN r317
2011-03-22 06:28:51 +00:00
Chris Lattner
a93a1f640b Rearrange some cases, only try to-tuple conversion if a tupleexpr isn't a grouping paren.
Swift SVN r315
2011-03-22 05:42:30 +00:00
Chris Lattner
fd2bf74f06 Move getCanonicalType from being a method on ASTContext to being a method on Type.
Swift SVN r314
2011-03-22 05:23:51 +00:00
Chris Lattner
e51f356bd6 Improve comments.
Swift SVN r313
2011-03-22 05:13:37 +00:00
Chris Lattner
aeb7c0895e The isGroupingParen() predicate doesn't make sense since TupleExpr can be used to create tuple expressions out of a scalar when there is a single element involved. In this case, isGroupingParen would return true but the source and dest types would be different.
This didn't manifest as a bug yet, but it doesn't make sense to wait until it does.  This aspect of grouping parens is a syntactic issue, so make the creator of TupleExpr specify whether the expr is a grouping paren or not and persist this.

Swift SVN r312
2011-03-22 05:04:48 +00:00
Chris Lattner
a1cf13d201 Switch ActOnTupleType to take an ArrayRef, simplifying it.
Swift SVN r311
2011-03-22 04:54:13 +00:00
Chris Lattner
ae2f026d3f Use isGroupingParen() in one more place, add a TupleExpr::getElementName helper method.
Swift SVN r310
2011-03-22 04:49:47 +00:00
Chris Lattner
20772e3b8e Add a TupleExpr::isGroupingParen() method and use it in a few places.
Swift SVN r309
2011-03-22 04:33:46 +00:00
Chris Lattner
e759c9c086 Fix bottom-up processing of tuple exprs in two ways:
1. Single-element tuples with names are not grouping parens.
2. Redo Sema of a tuple if we do propagate a type into it.

Also, remove the previous hack for trying to make:
  var e : ZeroOneTwoThree = :Three(1, 2, 3)

Unambiguous.  While it would be nice, it isn't essential and it clutters the model.


Swift SVN r308
2011-03-22 04:23:34 +00:00
Chris Lattner
094bbaae7d On second blush, this fix isn't a great one. Add a fixme and disable it for now so a test continues to fail.
Swift SVN r307
2011-03-21 23:15:56 +00:00
Chris Lattner
db44f883c9 Don't shave off "excess" elements of a body until the first element has a non-dependent type. Dependent types may resolve to functions and slicing of their bodies isn't a good idea.
Swift SVN r306
2011-03-21 23:00:20 +00:00
Chris Lattner
1fda8dd71d Fix a scoping problem with my recent "make oneof constructors have the right typealias name" patch.
Swift SVN r305
2011-03-21 22:56:00 +00:00
Chris Lattner
7406f8b201 Fix a case to look through typealiases where it should.
Swift SVN r304
2011-03-21 22:55:16 +00:00
Chris Lattner
bbac24c68e Improve struct declarations to use their TypeAlias for the constructor results. In the testcase we now get:
error: cannot convert initializer type 'CGPoint' to explicitly specified type 'int'
  var d : int = CGPoint(.y = 1, .x = 2);   // Using injected name.
                ^

instead of:
error: cannot convert initializer type 'oneof { CGPoint : (x : int, y : int)}' to explicitly specified type 'int'
  var d : int = CGPoint(.y = 1, .x = 2);   // Using injected name.
                ^


Swift SVN r298
2011-03-21 21:09:23 +00:00
Chris Lattner
024b479b76 Fix a crash on invalid: we can't produce null elements of brace exprs.
Swift SVN r297
2011-03-20 07:52:09 +00:00
Chris Lattner
ffb93e65b7 Fix a pretty big issue in typechecking. We were processing things like:
func f() {
   var x = 4
   f()
}

as:
   var x = (4 f())
not:
   var x = 4; f()



Swift SVN r295
2011-03-20 07:37:43 +00:00
Chris Lattner
c9eb885752 Introduce top-level expressions and simplify TranslationUnitDecl (and various things that hack on it) by making it hold a single BraceExpr instead of a list of exprs and decls.
Swift SVN r293
2011-03-20 06:59:37 +00:00
Chris Lattner
a1e6e7bfc3 implement name binding support (including looking through imports) for types! We can now have a swift standard library.
Swift SVN r292
2011-03-20 05:26:50 +00:00
Chris Lattner
968339faf0 Integer literals should refer to the integer_literal_type type alias decl, not to unresolvedtype directly!
Swift SVN r291
2011-03-20 05:26:26 +00:00
Chris Lattner
cb8884e832 Move error reporting for unresolved types from SemaDecl to NameBinding, where it should be. This requires enhancing TranslationUnitDecl to hold a list of unresolved types.
Swift SVN r290
2011-03-20 04:45:06 +00:00
Chris Lattner
097248057f Add a todo comment, use a note instead of warning in one case.
Swift SVN r289
2011-03-20 04:32:13 +00:00
Chris Lattner
204ffac987 Implement import for value names!
Swift SVN r288
2011-03-19 19:43:54 +00:00
Chris Lattner
6807ad7fb1 Move some type validity checking to SemaDecl::handleEndOfTranslationUnit, out of NameBinding.
Swift SVN r287
2011-03-19 06:41:26 +00:00
Chris Lattner
60cdb19d02 Add a new ImportDecl to represent imports.
Swift SVN r286
2011-03-19 06:22:47 +00:00
Chris Lattner
d23c2f26f3 Document and implement lexer and parser support for trivial import decls. No Sema/AST support yet.
Swift SVN r285
2011-03-18 22:52:48 +00:00
Chris Lattner
5e44da89af Change how integer literals get types. Instead of having TypeChecker force them to __builtin_int32_ty, have sema give them integer_literal_type, and expect the library to define what that actually is for a given file.
Swift SVN r282
2011-03-18 06:28:38 +00:00
Chris Lattner
4d5d33ddd4 Rework the argument binding logic to do the type application on the fly.
Swift SVN r281
2011-03-18 06:08:39 +00:00
Chris Lattner
78d6a6d5c6 Implement resolution and type assignment of Anonymous closure argument expressions
Swift SVN r280
2011-03-17 07:25:00 +00:00