Commit Graph

340 Commits

Author SHA1 Message Date
Dmitri Hrybenko
f90e0c153b Make 'override' a keyword
rdar://16462192

Swift SVN r16115
2014-04-09 14:19:50 +00:00
Dmitri Hrybenko
06175089ca LangRef: add array and dictionary literal syntax
Swift SVN r15507
2014-03-26 12:08:45 +00:00
Dmitri Hrybenko
2c717692ac LangRef: convert the section on switch and related sections to ReST, as I plan
to edit these for rdar://16301313


Swift SVN r15232
2014-03-19 09:40:12 +00:00
Joe Groff
b8d48dd7bb Change 'x.type' to 'x.dynamicType'.
It's not a common operation, so it doesn't need a terse name that occupies valuable identifier real estate.

Swift SVN r14932
2014-03-11 23:18:33 +00:00
Joe Groff
b08f06f191 Revert "Accept (and prefer) "import type" as a scoped import for any non-protocol type."
This reverts commit r14488, since we're demoting 'type' back to a plain old identifier.

We could consider reallowing 'type' as a contextual keyword here, but from talking to Jordan he was OK with just reverting this functionality.

Swift SVN r14931
2014-03-11 23:18:30 +00:00
John McCall
a9443d72f8 Parse attributes as part of <type> and simplify the grammar.
This means that we accept type attributes in a much broader
range of places where we previously required a <type>.  <type>
was already a production that demanded a grammatically
unconstrained context because of all the possible continuations;
reducing the number of independent productions makes it easier
to choose one and thus not accidentally limit the range of
possible types parsed.

In particular, we want to be able to parse @unchecked T? pretty
much anywhere you can write a type.

Swift SVN r14912
2014-03-11 07:59:22 +00:00
Doug Gregor
571ae697d5 Parsing and AST support for complete object initializers.
Enforce that complete object initializers always be delegating.

Swift SVN r14549
2014-03-01 00:51:18 +00:00
Jordan Rose
1fe8630bcd Accept (and prefer) "import type" as a scoped import for any non-protocol type.
Previously this was spelled "import typealias", and that spelling will
continue to be allowed (since someone may specifically be importing a
typealias and want that to match), but now that 'type' is a keyword,
"import type" is the right way to spell the generic "import any type"
scoped import.

Swift SVN r14488
2014-02-27 23:46:06 +00:00
Doug Gregor
dd143263eb Accept the "deinit { }" syntax, but don't require it.
Improve the Fix-It for the older "destructor" syntax so that it
replaces "destructor ()" with "deinit".

Swift SVN r14419
2014-02-26 22:42:14 +00:00
Chris Lattner
1344319677 Rename the internal compiler lexicon from val -> let.
Swift SVN r14408
2014-02-26 21:21:18 +00:00
Doug Gregor
981f8f6509 Rename "destructor" -> "deinit" (as a keyword) and -> "deinitializer" (in diagnostics).
Swift SVN r14380
2014-02-26 05:51:45 +00:00
Joe Groff
98d6fecc99 '.metatype' -> '.Type'
Also, reserve 'type' as a keyword for ensuing syntax changes.

Swift SVN r14375
2014-02-26 04:23:21 +00:00
Dmitri Hrybenko
c2db9a5ff0 Convert the section about subscript decls to ReST, since grammar here will
require updates as well


Swift SVN r14150
2014-02-20 14:40:23 +00:00
Dmitri Hrybenko
7fcbd1bffd LangRef: convert a section on var decls to ReST, since I am going to edit it to
change the getter/setter syntax (rdar://15966905)


Swift SVN r14148
2014-02-20 13:42:37 +00:00
Jordan Rose
0b2541b58f Rename the standard library to "Swift" (instead of "swift")
This is more in line with all other modules currently on our system.
If/when we get our final name for the language, we're at least now set
up to rename the library without /too/ much trouble. (This is mostly just
a lot of searching for "import swift", "swift.", "'swift'", and '"swift"'.
The compiler itself is pretty much just using STDLIB_NAME consistently now,
per r13758.)

<rdar://problem/15972383>

Swift SVN r14001
2014-02-17 19:30:47 +00:00
Chris Lattner
28903887e7 Rename the internal compiler lexicon from let -> val.
Swift SVN r13992
2014-02-17 16:48:21 +00:00
Dmitri Hrybenko
0b97b32f92 Start converting LangRef to ReST
Swift SVN r13972
2014-02-17 00:29:19 +00:00
Dmitri Hrybenko
571c9b3c5e Split 'type' keyword into 'static' and 'class'
rdar://15911697


Swift SVN r13908
2014-02-14 14:50:32 +00:00
Dave Abrahams
5063c33cbb Rename "Stream" protocol back to "Generator"
The name Stream didn't seem to be working out as intended; we kept
gravitating back to calling it Generator, which is precedented in other
languages.  Also, Stream seems to beg for qualification as Input or
Output.  I think we'd like to reserve Stream for things that are more
bulk-character-API-ish.

Swift SVN r13893
2014-02-14 01:48:52 +00:00
Dave Zarzycki
89cfcbfbae Misc LangRef updates
1) Document that a series of '.' are operators.
2) '@' was dropped as an operator in r5019.
3) Move some commentary into the main documentation.
4) Better cross-referencing.
5) Tuple dot expressions use integer literals, not $identifiers.

Swift SVN r13694
2014-02-09 04:39:47 +00:00
Dave Abrahams
6f03d836eb [stdlib] Half-open ranges are now spelled x...y
Fully-closed ranges are coming soon.  See the release notes for details.
Implements the "hard" part of <rdar://problem/14586400>

Swift SVN r13674
2014-02-08 05:37:57 +00:00
Dave Zarzycki
1e3fd1a5b1 Parser: allow '...' to be an operator for ranges
<rdar://problem/16018151> Allow me to declare an operator spelled "..."

Swift SVN r13670
2014-02-08 02:10:37 +00:00
Chris Lattner
827acad533 Various inout improvements:
- purge @inout from comments in the compiler except for places talking about
   the SIL argument convention.
 - change diagnostics to not refer to @inout
 - Change the astprinter to print InoutType without the @, so it doesn't show
   up in diagnostics or in closure argument types in code completion.
 - Implement type parsing support for the new inout syntax (before we just 
   handled patterns).
 - Switch the last couple of uses in the stdlib (in types) to inout.
 - Various testcase updates (more to come).



Swift SVN r13564
2014-02-06 06:22:27 +00:00
Doug Gregor
1f7292645e Introduce a short section describing Swift's contextual keywords.
Swift SVN r12047
2014-01-08 05:00:28 +00:00
Doug Gregor
14bf9ff89f Update LangRef for the "static" -> "type" change.
Swift SVN r12045
2014-01-08 05:00:20 +00:00
Dave Abrahams
ddab785fcf Replace stray "Enumerable"s with "Sequence"
There were a lot of instances of "Enumerable" that really should have
been changed already.  Along the way, I also

* Moved the adaptor that allows a Stream to be used as a Sequence into
  CompilerProtocols.swift; it's just an affordance to work around
  temporary inability to express the Stream protocol properly

* Made a trivial simplification in Algorithm.swift

Swift SVN r11946
2014-01-06 20:07:02 +00:00
Doug Gregor
fc00bf6076 Parsing and semantic analysis for delegating initializers.
Swift SVN r11921
2014-01-06 16:33:08 +00:00
Joe Groff
017440165e Fix the weird capitalization of MetaTypeType.
Swift SVN r11475
2013-12-19 18:43:08 +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
Chris Lattner
b6a648c3ab illustrate how let decls work with classes.
Swift SVN r11201
2013-12-12 19:19:53 +00:00
Chris Lattner
1a3ff1e9b2 implement 'let' pattern bindings.
Swift SVN r11199
2013-12-12 19:16:06 +00:00
Chris Lattner
65aa09d464 implement support for let declarations.
Swift SVN r11195
2013-12-12 18:33:42 +00:00
Chris Lattner
03518d240f revert r11192, I accidentally included too much in the patch.
Swift SVN r11193
2013-12-12 18:24:33 +00:00
Chris Lattner
778225eb96 Implement let declarations.
Swift SVN r11192
2013-12-12 18:22:46 +00:00
Dave Abrahams
7ab9d369aa [stdlib] Rename Char => UnicodeScalar
Swift SVN r10864
2013-12-05 17:30:37 +00:00
Jordan Rose
417b5d3982 Merge TranslationUnit into Module, and eliminate the term "translation unit".
This completes the FileUnit refactoring. A module consists of multiple
FileUnits, which provide decls from various file-like sources. I say
"file-like" because the Builtin module is implemented with a single
BuiltinUnit, and imported Clang modules are just a single FileUnit source
within a module.

Most modules, therefore, contain a single file unit; only the main module
will contain multiple source files (and eventually partial AST files).

The term "translation unit" has been scrubbed from the project. To refer
to the context of declarations outside of any other declarations, use
"top-level" or "module scope". To refer to a .swift file or its DeclContext,
use "source file". To refer to a single unit of compilation, use "module",
since the model is that an entire module will be compiled with a single
driver call. (It will still be possible to compile a single source file
through the direct-to-frontend interface, but only in the context of the
whole module.)

Swift SVN r10837
2013-12-05 01:51:15 +00:00
Dave Zarzycki
942b490342 Copy and paste error: we do not have a ** operator
Swift SVN r10819
2013-12-04 23:46:51 +00:00
Dave Zarzycki
ecb3563628 11242731 simplify precedence of binary operators
Swift SVN r10815
2013-12-04 23:31:16 +00:00
Doug Gregor
4d3e475973 Fix typo in example
Swift SVN r10784
2013-12-04 17:36:25 +00:00
Doug Gregor
627f0ae447 Allow "x as T" to perform implicit conversions from x to T.
Fixes <rdar://problem/15283100>.


Swift SVN r10783
2013-12-04 17:31:44 +00:00
Doug Gregor
002038ad8e Allow a comma-separated list of init expressions in C-style for loops.
Swift SVN r10748
2013-12-03 15:14:54 +00:00
Dave Zarzycki
83f953b80a 15242776 docs: Replace "Slice" with "Array"
Swift SVN r10710
2013-12-01 08:16:54 +00:00
Doug Gregor
19759529db Allow delayed identifier expressions (.foo) with static variables and methods.
This allows expressions such as ".foo" and ".foo(1)" to refer to
static variables and static methods, respectively, as well as enum
cases. 

To get here, rework the parsing of delayed identifier expressions a
bit, so that the argument itself is part of the delayed argument
expression rather than a separate call expression. This simplifies
both the handling of patterns of this form and the type checker, which
can now user simpler constraints.

If we really want to support (.foo)(1), we can make that work, but it
seems unnecessary and perhaps confusing.


Swift SVN r10626
2013-11-21 06:24:06 +00:00
Dmitri Hrybenko
81dc5deee8 Change 'def' keyword back to 'func'
Swift SVN r10522
2013-11-17 07:45:28 +00:00
Doug Gregor
5bdaf96a9b Update grammar for comma-separated increment expressions in C-style for loops.
The actual language change went into r10399.


Swift SVN r10409
2013-11-13 03:54:20 +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
Mark Lacey
eaa7018ed0 Fixup attribute syntax in LangRef.html.
There are still some [infix_left=] in the text. Based on
r4627 it looks like these can just be deleted, but I haven't
done so at this time.

Swift SVN r9616
2013-10-23 08:12:21 +00:00
Greg Parker
5708b8b6ec Remove mention of Optional.get().
Swift SVN r9605
2013-10-22 23:11:58 +00:00
Dmitri Hrybenko
dd66c7e455 Update LangRef for 'as' syntax change that happened some time ago
Swift SVN r9379
2013-10-15 21:52:34 +00:00
Chris Lattner
9f439292b6 Implement support for type-attributes on the result of a function type or decl.
Also, improve error recovery for new-syntax attributes.

This means that we now compile the testcase into:

t.swift:3:16: error: unknown attribute 'xyz'
var x : () -> @xyz Int
               ^
t.swift:6:16: error: unknown attribute 'xyz'
func foo() -> @xyz Int {
               ^

instead of:

t.swift:4:15: error: expected type for function result
func foo() -> @xyz Int {
              ^
t.swift:4:14: error: consecutive statements on a line must be separated by ';'
func foo() -> @xyz Int {
             ^
             ;
t.swift:4:16: error: unknown attribute 'xyz'
func foo() -> @xyz Int {
               ^
t.swift:7:1: error: expected declaration

^

this is part of rdar://15183765


Swift SVN r9260
2013-10-12 21:27:16 +00:00