Commit Graph

4421 Commits

Author SHA1 Message Date
Chris Lattner
b6f6eec106 implement rdar://11935352 - accepting closures with no body expression (the closure
just returns "()").


Swift SVN r2503
2012-08-02 20:08:51 +00:00
Daniel Dunbar
1eeecdd874 Change Swift docs to use Sphinx.
- I've converted every document except the LangRef, which is more trouble to
   convert because of the use of styling to embed notes.
 - 'make html' with sphinx-build in your path to build the docs.

Now back to my regularly scheduled breaking things. :)

Swift SVN r2410
2012-07-23 18:50:00 +00:00
Eli Friedman
4b34dc582b Add a quick description of constructors and destructors to LangRef.
Swift SVN r2349
2012-07-12 01:57:04 +00:00
Howard Hinnant
ce77e792cf Change the library feature list table from html to Numbers format.
Swift SVN r2276
2012-06-28 22:34:43 +00:00
Howard Hinnant
54c8160cc0 First cut at a library feature vs language table. Most of the entries are marked unknown. Please feel free to fill in any unknowns you know about. Also please feel free to add rows or columns.
Swift SVN r2262
2012-06-27 23:43:19 +00:00
Doug Gregor
35e6e56595 When we split a token starting with '<' or '>', make sure that the
resulting token goes back through the lexer to get the appropriate
token kind. Thanks to Chris for spotting this.

Also, document the '<' and '>' splitting behavior in LangRef.


Swift SVN r2192
2012-06-18 16:40:59 +00:00
Doug Gregor
1aea990492 Add protocol composition types to LangRef.
Swift SVN r2191
2012-06-18 16:14:42 +00:00
Doug Gregor
afec173412 Fix typo
Swift SVN r2190
2012-06-18 14:35:27 +00:00
Chris Lattner
db0cd646fc lexer/parser/ast/sema support for do/while statements. irgen next.
Swift SVN r2186
2012-06-17 02:29:54 +00:00
Chris Lattner
2db5fa5851 remove an obsolete doc.
Swift SVN r2184
2012-06-10 17:44:09 +00:00
Dave Zarzycki
aedcded31d Fix a couple missing newlines, one leads to printing weirdness
Swift SVN r2178
2012-06-08 22:59:39 +00:00
John McCall
8c46c69efa Lexically distinguish prefix, postfix, and binary operators
and use this information as cues in the language.  Right now,
we do not accept things like "-- *i" because the prefix
operator is not correctly right-bound;  instead you have to
write "--(*i)".  I'm okay with that;  I did add a specialized
diagnostic recognizing operator-binary in a place where we're
expecting a potential operator-prefix.

Swift SVN r2161
2012-06-07 01:00:06 +00:00
Doug Gregor
de06e10c67 Update generics documentation with our plan of record for dealing with
the generic-specialization-or-less-than parsing ambiguity.


Swift SVN r2143
2012-06-04 23:18:20 +00:00
Doug Gregor
1bf18a2472 Implement requirements on associated types (<rdar://problem/11548273>).
Swift SVN r2134
2012-06-04 16:43:40 +00:00
Doug Gregor
9abd2340bc Allow an 'inheritance' clause on typealiases, specifying what
protocols the underlying type of the type alias shall conform to. This
isn't super-motivating by itself (one could extend the underying type
instead), but serves as documentation, makes typealiases provide the
same syntax as other nominal types in this regard, and will also be
used to specify requirements on associated types.


Swift SVN r2133
2012-06-04 16:15:47 +00:00
Doug Gregor
b099a17f9a Remove protocol-body production from the grammer. It isn't needed
Swift SVN r2131
2012-06-04 15:46:07 +00:00
Doug Gregor
b054b0767e Update generics manifesto based on some feedback from Chris.
Swift SVN r2128
2012-06-04 14:59:42 +00:00
Doug Gregor
05ac354bce Capitalize type names in Generics manifesto
Swift SVN r2107
2012-06-01 00:05:28 +00:00
Doug Gregor
731f8f1141 Update Generics manifesto with:
- Up-to-date syntax
  - Discussion of operator/property/subscripting requirements
  - Associated type requirements
  - Isolating implicit conformance from the rest of the model (with
  revised definition of 'Any')
  - A few more words on the implementation model
  - A discussion of some thorny parsing issues



Swift SVN r2106
2012-06-01 00:04:19 +00:00
Chris Lattner
53b09c613a Switch type alias to use = for assignment instead of :, which indicates conformance.
This resolves rdar://11547856



Swift SVN r2064
2012-05-30 00:32:23 +00:00
Eli Friedman
a454d62619 Implement some reasonable shadowing rules for declarations.
Swift SVN r2061
2012-05-29 23:48:40 +00:00
Eli Friedman
bb0a98d487 Finish off varargs.
Swift SVN r1892
2012-05-18 00:04:07 +00:00
Eli Friedman
c415ea2b0d Get rid of an incorrect statement.
Swift SVN r1872
2012-05-16 18:38:50 +00:00
Eli Friedman
723e1b8158 Some hacking on LangRef to catch up with recent changes to oneofs, structs, and classes.
Swift SVN r1868
2012-05-16 02:08:31 +00:00
Doug Gregor
245d2a46f2 Parse an 'inheritance' clause on extensions, oneofs, structs, and
classes, with the same syntax as we have on protocols. This
inheritance specifies explicit conformance to a protocol.

Later, we can allow a class definition to have a single class type
within this list, when we introduce class inheritance.



Swift SVN r1862
2012-05-15 23:39:19 +00:00
Doug Gregor
515bcb44e9 Allow subscript declarations in protocols, which require a suitable
subscripting operator. Such protocols are fairly useful without
associated types, however.


Swift SVN r1831
2012-05-14 15:56:58 +00:00
Doug Gregor
70bfc235b8 Implement protocol inheritance, e.g.,
protocol Document { var title : String }
  protocol Versioning { func bumpVersion() }
  protocol VersionedDocument : Document, Versioning { }

This commit covers the basic functionality of protocol inheritance, including:
  - Parsing & AST representation
  - Conforming to a protocol also requires conforming to its inherited
  protocols
  - Member lookup into a protocol also looks into its inherited
  protocols (results are aggregated; there is no name hiding)
  - Teach ErasureExpr to maintain lvalueness, so we don't end up
  performing a silly load/erase/materialize dance when accessing
  members from an inherited protocol.




Swift SVN r1804
2012-05-11 00:00:50 +00:00
Eli Friedman
d10f2b62b7 Some doc tweaks for for-each.
Swift SVN r1802
2012-05-10 22:53:54 +00:00
Doug Gregor
169dd225bf Switch Parser::parseProtocolBody() over to use parseDecl(), with a
giant list of "you can't do that" restrictions. Update grammar
accordingly, killing off decl-var-simple.



Swift SVN r1781
2012-05-09 00:35:53 +00:00
Doug Gregor
a581941440 Tighten up protocol parsing a bit.
Swift SVN r1779
2012-05-08 23:49:20 +00:00
John McCall
ad9290796c At Chris's request, extract out some exposition into a document
about logical objects.

Swift SVN r1767
2012-05-08 00:59:34 +00:00
Doug Gregor
302de6632d Switch the for-each loop informal protocol from getFirst()/dropFirst()
to the more input-iterator-centric getFirstAndAdvance(). Fixes
<rdar://problem/11401273>.


Swift SVN r1766
2012-05-08 00:37:01 +00:00
Chris Lattner
2a1e15f372 document string literal interpolation in langref.
Swift SVN r1742
2012-05-04 06:33:40 +00:00
Chris Lattner
46c94377f1 Add support for var decls in the initializer of a c-style for loop,
implementing rdar://11360347 / 11349750.  C-style for loops could be
further enhanced by allowing a comma-separated list of statements in
the increment, but this isn't something I plan to do in the short term.


Swift SVN r1713
2012-05-02 05:44:58 +00:00
Chris Lattner
8c478d1cb7 remove the foreach keyword, switching foreach loops to use 'for' instead.
This uses one-token lookahead to distinguish between the two forms.


Swift SVN r1710
2012-05-02 01:06:06 +00:00
Chris Lattner
e205e1d2da change the subset of for statements we support: instead of *requiring* parens,
now we *do not allow* them.  This is progress towards unifying for and foreach.


Swift SVN r1709
2012-05-02 00:43:24 +00:00
Chris Lattner
48f1556a1a Change swift to special case ++ and -- as unary-only operators. Making them
useful.  This resolves:
 <rdar://problem/11297111> ++ and -- operators are annoyingly confused with binary operators

for now.



Swift SVN r1703
2012-05-01 17:56:22 +00:00
Doug Gregor
e150bfe599 Remove my ancient notes
Swift SVN r1692
2012-04-30 18:07:56 +00:00
Doug Gregor
1b29b6f9f7 Minor tweaks to the generics manifesto. The bits about protocols might
make good reading for today ;)


Swift SVN r1691
2012-04-30 18:07:38 +00:00
Chris Lattner
ad5c0bba59 move two docs out of the Notes directory, since most of the docs are notes.
Doug, do we still need your old notes?


Swift SVN r1682
2012-04-28 23:21:21 +00:00
Chris Lattner
c63e6b2eb1 remove some old and really obsolete dox.
Swift SVN r1681
2012-04-28 23:20:25 +00:00
Eli Friedman
f41253e299 Add a couple of missing semantic checks for default values in tuples. Add a bit more clarifying wording to LangRef.
Swift SVN r1678
2012-04-27 23:40:43 +00:00
Eli Friedman
3c8802edbf Add syntax for declaring multiple unrelated variables on a single line ("var x = 10, y = 20.0"), like we claimed to support during the demo.
Swift SVN r1677
2012-04-27 22:40:48 +00:00
Chris Lattner
c7e68a4a8b langref and lexer support for character literals.
Swift SVN r1671
2012-04-27 05:51:30 +00:00
Doug Gregor
27483ce4e1 s/empty/isEmpty/g for the foreach loop informal protocol, because
function names should start with verbs.


Swift SVN r1607
2012-04-24 21:50:12 +00:00
Doug Gregor
ac188c7d59 Implement type checking for the foreach loop and extend the AST to
hold all of the various expressions and declarations we'll need to
understand its semantics.


Swift SVN r1596
2012-04-24 20:22:36 +00:00
Doug Gregor
f997a781bf Parsing and basic AST representation for 'foreach' statement.
Swift SVN r1594
2012-04-24 18:12:44 +00:00
Doug Gregor
4fe85d698a Update LangRef documentation for subscript declarations and subscript
expressions, with a fun little bit vector example.


Swift SVN r1532
2012-04-20 16:47:26 +00:00
John McCall
66318f5e12 First round of type-checking for new-expressions: form
the appropriate slice type and check the bounds.  The
first bound must be a literal or a type with a
getArrayBoundValue method, which has the same recursive
nature as getLogicValue (i.e. it can return a type that
has a getArrayBoundValue that returns an integral type,
but that's it;  it's capped at one hop).  The rest
of the bounds must be empty (meaning a slice) or
constant under the same conditions as fixed-size
array types.

Swift SVN r1501
2012-04-19 21:05:37 +00:00
Doug Gregor
846aa7e162 Diagnose attempts to declare subscript operations outside of a type context.
Swift SVN r1497
2012-04-19 20:41:42 +00:00