Commit Graph

215 Commits

Author SHA1 Message Date
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
Jordan Rose
308c6139f9 Change ASTContext::allocate(unsigned) to return a MutableArrayRef.
...rather than a raw pointer that points to a buffer with space for N
elements. Just because we *can* get N from context doesn't mean it's
convenient/safe.

No functionality change.

Swift SVN r11488
2013-12-19 23:25:04 +00:00
Jordan Rose
7a30de2efe Disallow inheritance clauses for concrete typealiases.
typealias MyInt: ForwardIndex = Int

There is no real reason to allow this; it's just a static_assert that Int
conforms to ForwardIndex, which would be better spelled some other way.

This only applies to concrete typealiases, i.e. those that simply alias an
underlying type. Associated types can still have both inheritance clauses
and a (default) underlying type.

Swift SVN r11481
2013-12-19 21:13:54 +00:00
Joe Groff
017440165e Fix the weird capitalization of MetaTypeType.
Swift SVN r11475
2013-12-19 18:43:08 +00:00
Jordan Rose
7d1c35f859 Don't immediately type-check synthesized RawRepresentable functions for enums.
Before, the synthesized bodies were immediately fed into the type-checker.
However, it's possible the bodies could reference something that hasn't yet
been deserialized. Type-check them along with other implicitly-generated
declarations at the end of type-checking.

Swift SVN r11217
2013-12-12 23:31:13 +00:00
Chris Lattner
698380d6d3 Introduce a new bit in VarDecl, "isLet". Teach Sema that 'isLet' properties
are not settable (like get-only ones).  Set the 'isLet' bit in various 
places, but not the particularly interesting or useful places yet.



Swift SVN r11121
2013-12-11 06:45:40 +00:00
Dmitri Hrybenko
d076501cca Don't repeat Context.getIdentifier("self") everywhere in the code base
Swift SVN r10786
2013-12-04 18:42:34 +00:00
Dmitri Hrybenko
81dc5deee8 Change 'def' keyword back to 'func'
Swift SVN r10522
2013-11-17 07:45:28 +00:00
Joe Groff
4f2adbe7ed AST: Include 'static' bit in VarDecls.
And track the 'static' SourceLoc in the PatternBindingDecl. This lets isInstanceMember return the right thing for static vars.

Swift SVN r10369
2013-11-12 06:16:48 +00:00
Anna Zaks
54524e622a Replace ExprStmtOrDecl with ASTNode and make it a struct.
Previously, the Parser and BranchStmt typedef-ed ExprStmtOrDecl as a pointer union. Using typedef made the objects compatible, but did not allow us to extend the type with helper methods, such as getSourceRange(), which is something you can get on all of the AST objects. This patch introduces ASTNode that subclasses from PointerUnion and is used by both parser and BranchStmt.

Swift SVN r9971
2013-11-05 21:46:59 +00:00
Dmitri Hrybenko
91ce21666d Change 'func' keyword to 'def'
I tried hard find all references to 'func' in documentation, comments and
diagnostics, but I am sure that I missed a few.  If you find something, please
let me know.

rdar://15346654


Swift SVN r9886
2013-11-02 01:00:42 +00:00
Dmitri Hrybenko
011284e9c9 Make minus sign part of IntegerLiteralExpr and make integers literals 136-bits
wide

Currently integer literals are 64-bit.  In order to allow checking for overflow
while converting an integer literal to swift.UInt/Int* types we need at least
65 bits.  But floating point numbers (Float32, Float64, Float80) are
BuiltinIntegerLiteralConvertible.  In order to allow spelling large floating
point constants, we allow 136-bit literals.

Rationale: 128 bits are enough to represent the absolute value of min/max IEEE
Binary32, and we need 1 bit to represent the sign.  136 is 129 rounded to the
next 8 bits.

The plan is to have builtins that do the overflow check and convert 136-bit
numbers to the required width.  We need these builtins for both integers and
floating point numbers to ensure that 136-bit numbers are folded into sane
constants in SIL and don’t escape to LLVM IR.


Swift SVN r9253
2013-10-12 04:52:11 +00:00
Doug Gregor
fdd203f9bc Compute interface types for non-generic functions in a generic context.
Non-generic functions within a generic nominal type have generic
signatures, because their curried 'self' arguments are of bound
generic type. 


Swift SVN r8964
2013-10-07 17:04:29 +00:00
Joe Groff
0d8d756c83 Sema: Teach conformance checking to derive requirements if needed.
For derivable protocols, such as RawRepresentable on raw-typed enums, when checking the conformance, create a conforming decl if an explicit decl wasn't found. Refactor the conformance derivation for toRaw/fromRaw to be driven by conformance checking in this way.

Swift SVN r8930
2013-10-04 20:50:43 +00:00
Joe Groff
fb7fb33be6 Sema: Synthesize raw type methods for enums.
If an enum has a valid raw type, synthesize a RawType associated type along with fromRaw and toRaw methods.

An implicit conformance to RawRepresentable is not yet set up. This synthesis may need to be done earlier in order for the names to be available during type-checking of definitions in the enum too.

Swift SVN r8890
2013-10-03 21:55:53 +00:00