Commit Graph

2092 Commits

Author SHA1 Message Date
Joe Groff
0776c4b6b8 SIL: Reorient function type lowering toward interface types.
Lower types for SILDeclRefs from the interface types of their referents, dragging the old type along for the ride so we can still offer the context to clients that haven't been weaned off of it. Make SILFunctionType's interface types and generic signature independent arguments of its  Derive the context types of SILFunctionType from the interface types, instead of the other way around. Do a bunch of annoying inseparable work in the AST and IRGen to accommodate the switchover.

Swift SVN r12536
2014-01-18 19:42:02 +00:00
John McCall
1bc1c669a2 Add the '@unchecked T?' syntactic sugar for UncheckedOptional<T>.
Swift SVN r12128
2014-01-10 19:13:51 +00:00
Manman Ren
ce642b89f7 Move printing of DeclAttributes from PrintAST::printAttributes to
DeclAttributes::print.

Also add printing of mutating to the print functions.
In serializer, print out the unhandled attributes.


Swift SVN r12073
2014-01-08 23:44:05 +00:00
Doug Gregor
9412c07dea Switch 'static' to 'type' in tests.
Switch some diagnostic text from 'static' over to 'type' to make
things easier, and fix up some parsing issues with selector-style
declarations found by doing this. NFC


Swift SVN r12030
2014-01-08 01:37:32 +00:00
Joe Groff
25ef450017 SIL: Print SILFunctionTypes using their interface types.
Swift SVN r11852
2014-01-03 06:09:44 +00:00
Joe Groff
8bebb084e6 Rename 'RequirementKind::ValueWitnessMarker' to 'WitnessMarker'.
It's witnessing protocol requirements, not values, and "value witness" has a particular meaning in IRGen.

Swift SVN r11814
2014-01-02 17:47:40 +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
60cfcf74e9 - delete a dead function from the AST verifier,
- fix some logic in the type checker that only works on
  implicit lvalues to be explicit about that.
- update some comments



Swift SVN r11707
2013-12-28 23:55:33 +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
d7621b5a7b Remove the concept of a "nonsettable lvalue": Now everything that is
nonsettable is represented as an rvalue.  Yay for one less concept in
the AST.


Swift SVN r11640
2013-12-25 22:20:01 +00:00
Joe Groff
63d08c786d SIL: Handle metatype abstraction differences.
Lower metatype types as @thin or @thick based on whether the type is static and whether the abstraction pattern allows for a thin metatype. Add a '@thick' attribute and require SIL metatypes to always be annotated with either '@thin' or '@thick' to distinguish them from unlowered metatypes.

Swift SVN r11525
2013-12-20 23:06:16 +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
Joe Groff
2af06d7a14 Allow a '@thin' modifier on metatypes in SIL mode.
Because of abstraction difference, unitary metatype types may still need a non-empty representation in positions where they substitute an archetype metatype. Borrow the '@thin' attribute to make empty metatype types explicit, so that we will be able to handle them correctly with respect to abstraction changes.

Swift SVN r11473
2013-12-19 18:26:10 +00:00
Doug Gregor
ec4913b0ea Implement default definitions for associated types.
Addresses <rdar://problem/14292873>.


Swift SVN r11422
2013-12-18 06:24:53 +00:00
Argyrios Kyrtzidis
ece603b1ed [ASTPrinter] Add an option in swift-ide-test to print a module interface with annotations and test it.
Swift SVN r11368
2013-12-17 02:19:54 +00:00
Dmitri Hrybenko
2c4c7ffcfa AST printer: ensure a stable printing order for ImportDecls
Swift SVN r11366
2013-12-17 01:34:07 +00:00
Dmitri Hrybenko
c54c979f95 Clang importer: don't add @objc *attribute* to imported decls, just set the objc bit
AST printer: print @objc attribute only on top-level imported decls to reduce
the amount of noise.


Swift SVN r11365
2013-12-17 00:50:12 +00:00
Argyrios Kyrtzidis
93c15bed50 [AST] Introduce the ASTPrinter class, and have its callbacks invoked during AST printing.
This provides useful extension points during AST printing.

Swift SVN r11338
2013-12-16 01:26:36 +00:00
Dmitri Hrybenko
bd314574bc Set options for module interface printing in printModuleInterface(),
rather than in swift-ide-test


Swift SVN r11232
2013-12-13 02:25:49 +00:00
Dmitri Hrybenko
374aa1d57c AST printing: when printing module interface, explode PatternBindingDecls
The exact pattern that was used to declare a variable is not important from the
module interface point of view.


Swift SVN r11231
2013-12-13 02:19:04 +00:00
Dmitri Hrybenko
b5b46ca022 Remove stale fixme: Decl::shouldPrintInContext() should not be responsible for
skipping implicit decls, there is an AST priting option for that.


Swift SVN r11228
2013-12-13 01:42:42 +00:00
Dmitri Hrybenko
ee8a9af14d AST printer: add an option to print types qualified if they are possibly ambiguous
Swift SVN r11210
2013-12-12 21:25:05 +00:00
John McCall
0bfa86673f Introduce (but don't yet create) a new kind of DeclContext for
various kinds of expressions that appear outside of local
evaluation contexts.

Swift SVN r11176
2013-12-12 03:36:17 +00:00
Joe Groff
5a08bfae70 Extend SubstitutableType::getName() to handle dependent substitutable types.
And factor the code that produces the canonical '$T_n_n' names into it.

Swift SVN r10986
2013-12-07 23:56:28 +00:00
Dmitri Hrybenko
11ccb38e06 AST printer: use getDisplayDecls() to find a list of decls to print.
We are still not completely correct in determining which extensions to print,
will fix in future patches.


Swift SVN r10960
2013-12-07 00:54:05 +00:00
Argyrios Kyrtzidis
345564380c Rename 'ibaction/iboutlet' attributes to 'IBAction/IBOutlet'.
Swift SVN r10953
2013-12-07 00:14:51 +00:00
Dmitri Hrybenko
8fcb7c428c AST printer: print declarations from a module in alphabetical order
Also, move module interface printing to libAST to make it reuseable.


Swift SVN r10932
2013-12-06 20:23:54 +00:00
Joe Groff
0ff977d407 Add a 'WitnessMethod' enumerator to AbstractCC.
We'll use this to represent the slightly-different polymorphic calling convention used for passing Self into protocol witnesses.

Swift SVN r10898
2013-12-06 01:32:35 +00:00
Jordan Rose
eede5ec4f9 Begin refactoring for mixed file kinds within a single module.
The goal of this series of commits is to allow the main module to consist
of both source files and AST files, where the AST files represent files
that were already built and don't need to be rebuilt, or of Swift source
files and imported Clang headers that share a module (because they are in
the same target).

Currently modules are divided into different kinds, and that defines how
decls are looked up, how imports are managed, etc. In order to achieve the
goal above, that polymorphism should be pushed down to the individual units
within a module, so that instead of TranslationUnit, BuiltinModule,
SerializedModule, and ClangModule, we have SourceFile, BuiltinUnit,
SerializedFile, and ClangUnit. (Better names welcome.) At that point we can
hopefully collapse TranslationUnit into Module and make Module non-polymorphic.

This commit makes SourceFile the subclass of an abstract FileUnit, and
makes TranslationUnit hold an array of FileUnits instead of SourceFiles.
To demonstrate that this is actually working, the Builtin module has also
been converted to FileUnit: it is now a TranslationUnit containing a single
BuiltinUnit.

Swift SVN r10830
2013-12-05 01:51:03 +00:00
Dmitri Hrybenko
e2bb01f8ea AST printer: don't forget to pass down printing options when printing tuples
and function return types

rdar://15576210


Swift SVN r10752
2013-12-03 19:56:35 +00:00
John McCall
20e58dcf93 Change the type of function values in SIL to SILFunctionType.
Perform major abstraction remappings in SILGen.  Introduce
thunking functions as necessary to map between abstraction
patterns.

Swift SVN r10562
2013-11-19 22:55:09 +00:00
Dmitri Hrybenko
81dc5deee8 Change 'def' keyword back to 'func'
Swift SVN r10522
2013-11-17 07:45:28 +00:00
Joe Groff
19457c12ea Give Builtin.Word an abstract size.
Instead of hardcoding Builtin.Word to be an alias for Builtin.Int64, make it its own type of abstract pointer width.

- Change BuiltinIntegerType's width representation to accommodate abstract widths.

- In the AST and in SIL, store values of the types as the greatest supported size for the abstract width (64 bits for a pointer).

- Add some type safety to the ([sz]ext|trunc)(OrBitCast)? builtins that they're used appropriately given the upper and lower bounds of the abstract sizes they're working with.

- Now that Builtin.Word is a distinct type, give it its own mangling.

- In IRGen, lower pointer-sized BuiltinIntegerType appropriately for the target, and truncate lowered SIL values if necessary.

Fixes <rdar://problem/15367913>.

Swift SVN r10467
2013-11-14 19:56:26 +00:00
Joe Groff
b64d601bba Sema: Don't try to initialize static properties in implicit constructors.
The implicit default constructor shouldn't try to initialize static properties, and the implicit memberwise constructor shouldn't have arguments for static properties.

Swift SVN r10378
2013-11-12 22:10:15 +00:00
Doug Gregor
e5ca2c90d0 Parse @optional attribute on protocol members.
Swift SVN r9959
2013-11-05 15:58:19 +00:00
Dmitri Hrybenko
2e2f651f10 @objc inference: we don't ever infer @objc on a protocol
Swift SVN r9937
2013-11-04 23:14:41 +00:00
Chris Lattner
68af974227 Remove 'axle' related code and build machinery. It turns out that we
will not be pursuing this project in the immediate future.



Swift SVN r9901
2013-11-03 16:04:27 +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
8be81e8bfd @objc inference: add tests for inferring @objc on a class
Swift SVN r9837
2013-10-31 01:45:00 +00:00
Dmitri Hrybenko
1abce88392 AST Printer / @objc: print @objc(inferred) for constructors and destructors
Swift SVN r9833
2013-10-31 01:01:29 +00:00
Dmitri Hrybenko
324e6940c4 AST Printer / @objc: print @objc(inferred) for stored properties
Swift SVN r9832
2013-10-31 00:50:21 +00:00
Dmitri Hrybenko
a1b1be735a AST Printer: print inferred @objc attributes for variables, properties, and
getters/setters


Swift SVN r9822
2013-10-30 23:07:33 +00:00
Argyrios Kyrtzidis
e31c93add3 [AST] The ASTContext parameter in FuncDecl::getResultType() is not really needed.
Swift SVN r9798
2013-10-30 17:09:56 +00:00
Jordan Rose
0702acab3d Make SourceFile a DeclContext, but don't actually do anything with it yet.
Swift SVN r9646
2013-10-24 18:59:21 +00:00
Doug Gregor
d7a1d536b4 Introduce value witness markers into the generic set of requirements.
Value witness markers note the location within a generic function
type's list of requirements where the value witness table will be
placed when calling a generic function with that type. It allows one
to get the same effect from walking the requirements of a generic
function that one would get from walking all levels of a
GenericParamList, with all archetypes of each generic parameter list,
along with all of the protocols to which each archetype conforms,
which SILGen and IRGen both do.

AST verification ensures that the property above holds; we're not
making use of it just yet.


Swift SVN r9509
2013-10-19 00:19:01 +00:00
Joe Groff
5721bdda01 Don't pretend we can parse enum case refined types.
There's no way we'll be able to fully implement GADTs anytime soon.

Swift SVN r9477
2013-10-18 01:34:25 +00:00
Chris Lattner
d564b86916 fix the astprinter to print attributes in the right place, which should
fix IDE/print_ast_tc_decls.swift


Swift SVN r9286
2013-10-13 16:29:59 +00:00
Chris Lattner
6d6ad84831 switch ast printer to print attributes in the new syntax.
Swift SVN r9281
2013-10-13 14:56:54 +00:00
Dmitri Hrybenko
d585bf1a73 Fix tests after r9275
Swift SVN r9279
2013-10-13 06:56:43 +00:00