Commit Graph

352 Commits

Author SHA1 Message Date
Joe Groff
24570fecc9 De-intrinsify and remove the _does*OptionalHaveValue functions.
Swift SVN r22955
2014-10-26 22:34:31 +00:00
Dave Abrahams
8b9772d64e Revert "De-intrinsify and remove the _does*OptionalHaveValue functions."
This reverts commit r22829, because reverting r22828 depends on it.
Reverting r22828 because it
was apparently causing an assertion on the bot:

Swift SVN r22830
2014-10-19 19:54:34 +00:00
Joe Groff
7a24c85ed8 De-intrinsify and remove the _does*OptionalHaveValue functions.
Swift SVN r22829
2014-10-19 00:08:30 +00:00
Chris Lattner
1436c35eb4 now that Beta 5 has branched, we can remove some migration stuff from
what will become beta 6.  This resolves:

<rdar://problem/17662823> Beta 6: remove "operator infix" -> "infix operator" rewrite
<rdar://problem/17670579> Remove @assignment fixit upgrade logic
<rdar://problem/17747208> remove auto_closure upgrade logic after Beta 5 branches



Swift SVN r20629
2014-07-28 16:38:31 +00:00
Dmitri Hrybenko
d14f17beef Change 'getLogicValue()' into a property 'boolValue'; change
'getArrayBoundValue()' into a property 'arrayBoundValue'.

rdar://17156123


Swift SVN r20304
2014-07-22 12:08:10 +00:00
Chris Lattner
bc481f0fe1 implement <rdar://problem/16859927> remove the underscore in "auto_closure"
autoclosure is one work, not two.



Swift SVN r20253
2014-07-21 15:23:50 +00:00
Joe Groff
c556d92ccd SILGen: Implement codegen for lvalue ForceValueExprs.
Add a set of _preconditionOptionalHasValue intrinsics that merely test that an optional has a case. Emit an lvalue ForceValueExpr as a physical lvalue, first asserting the precondition then projecting out the Some payload.

Swift SVN r20188
2014-07-18 22:49:49 +00:00
Dave Abrahams
9c6d9907a8 [docs] Correct a missed protocol rename in LangRef
Swift SVN r19936
2014-07-14 17:35:33 +00:00
Chris Lattner
57cd2506ff Change "operator infix" to "infix operator" for consistency with the rest of the declaration
modifiers and with the func implementations of the operators.  This resolves the rest of:
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword




Swift SVN r19931
2014-07-14 16:39:10 +00:00
Chris Lattner
8991456ff2 Switch infix/postfix/prefix to be declaration modifiers instead of attributes,
eliminating the @'s from them when used on func's.  This is progress towards
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword

This also consolidates rejection of custom operator definitions into one
place and makes it consistent, and adds postfix "?" to the list of rejected
operators.

This also changes the demangler to demangle weak/inout/postfix and related things
without the @.



Swift SVN r19929
2014-07-14 15:51:49 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Chris Lattner
2dc1df52d1 Implement <rdar://problem/16954464> Cannot make a strong IBOutlet
This adds support for the "strong" ownership modifier, and specifically 
make it override the "implicit weak" behavior of @IBOutlet.



Swift SVN r18737
2014-06-08 20:49:21 +00:00
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