Commit Graph

87 Commits

Author SHA1 Message Date
Dave Abrahams
17de46f1c9 [stdlib] ExistentialCollection: perf de-regression
The performance regression that occurred when ++ and -- were added as
requirements to the Index protocols was due to the fact that it caused a
dubious hack of mine to be bypassed: when treated as indices, integer
types are incremented and decremented without overflow checking.  While
technically justifiable (see the r20576 commit message), this makes the
standard library extremely fragile and makes successor() and
predecessor() mathematically unsafe. We really should see what the
optimizer team can do to make that hack unnecessary.

In the meantime, instead of dispatching through ++ and --, use a
special, defaulted _[successor|predecessor]InPlace() method to give
indices their own, customizable in-place inc/dec-rement path.

Swift SVN r26926
2015-04-03 02:39:40 +00:00
Dave Abrahams
35652f2d8d [stdlib] Mirror: Nix ObjectiveCObject DisplayStyle
Enrico has agreed that it's no longer needed.

Swift SVN r26920
2015-04-03 00:22:16 +00:00
Dave Abrahams
2ccf038237 [stdlib] Mirror comment: add missing example
Swift SVN r26919
2015-04-03 00:16:41 +00:00
Dave Abrahams
44bd9c0c46 [stdlib] Mirror: Tweaks in response to API review
* Use "reflecting:" rather than "reflect:" as an argument label.  It
  reads more sensibly.

* Unify toString()/toDebugString() with other reflection APIs by converting
  them into String initalizers, and by renaming Printable/DebugPrintable to
  CustomStringConvertible and CustomDebugStringConvertible.

* Drop "make" prefix from "makeCustomMirror" and
  "makeCustomPlaygroundQuickLook".  It is not, as we had thought,
  mandated by Cocoa naming guidelines.

Swift SVN r26918
2015-04-02 23:52:11 +00:00
Michael Gottesman
d53bff777b Revert "[stdlib] ExistentialCollection -> public/core"
This reverts commit r26888. Trying to fix the build.

Swift SVN r26911
2015-04-02 22:55:29 +00:00
Chris Willmore
690daa539a Back out changes for in-place methods/operators from Xcode 7.
This reverts commits r26508, r26545, and r26576.

Swift SVN r26900
2015-04-02 21:14:28 +00:00
Dave Abrahams
910c895346 [stdlib] ExistentialCollection -> public/core
It passed our API review so integrating it into the core standard
library.

Swift SVN r26888
2015-04-02 20:17:53 +00:00
Dave Abrahams
e0a0113333 [stdlib] ExistentialCollection: rename a parameter
Any name of the form 'nextXXX' is apt to be interpreted as "the next
XXX," which isn't appropriate here.

Swift SVN r26887
2015-04-02 20:04:17 +00:00
Dave Abrahams
e93a3e30db [stdlib] ExistentialCollection: fix up comments
Swift SVN r26886
2015-04-02 20:04:16 +00:00
Dave Abrahams
44bddea674 [stdlib] Protocol-dispatch ++ and -- for indices
...and take advantage of this capability to optimize AnyXXXIndex.

Swift SVN r26876
2015-04-02 17:21:45 +00:00
Dave Abrahams
1f1cf13dc6 [stdlib] Mirror review update
Alex Migicovsky pointed out that initialization with a DictionaryLiteral
should really allow heterogeneous element types!

Swift SVN r26621
2015-03-27 02:35:51 +00:00
Dave Abrahams
0b0976fcc5 [stdlib] ExistentialCollection: post-review changes
Swift SVN r26598
2015-03-26 19:47:39 +00:00
Graham Batty
477b69749d Putting incorrectly removed spaces back. NFC.
Swift SVN r26538
2015-03-25 15:55:59 +00:00
Dave Abrahams
3ca8e20fda [stdlib] Mirrors: more renaming for uniformity
Swift SVN r26522
2015-03-25 04:57:17 +00:00
Dave Abrahams
34af1fbccf [stdlib] Mirrors: Implement the QuickLook stuff
Swift SVN r26521
2015-03-25 04:57:16 +00:00
Dave Abrahams
0f7c52fc00 [stdlib] reflect(x) => Mirror(reflect: x)
Swift SVN r26520
2015-03-25 04:57:15 +00:00
Dave Abrahams
21da78388e [stdlib] Mirrors: rename "Schema" to "DisplayStyle"
Swift SVN r26513
2015-03-25 02:00:34 +00:00
Dave Abrahams
2a84ade467 [stdlib] Clarify an oft-repeated doc comment
Thanks, Dmitri!

Swift SVN r26512
2015-03-25 01:54:08 +00:00
Dave Abrahams
1f76eca539 [stdlib] Mirrors: apply pre-review commentary
most of it, anyway. Thanks, Dmitri!

Swift SVN r26511
2015-03-25 01:54:05 +00:00
Chris Willmore
1ee6f7e67c Implement syntax changes for in-place methods.
Rename 'assignment' attribute of infix operators to 'mutating'. Add
'has_assignment' attribute, which results in an implicit declaration of
the assignment version of the same operator. Parse "func =foo"
declaration and "foo.=bar" expression. Validate some basic properties of
in-place methods.

Not yet implemented: automatic generation of wrapper for =foo() if foo()
is implemented, or vice versa; likewise for operators.

Swift SVN r26508
2015-03-25 00:22:41 +00:00
Dave Abrahams
f5fb694b49 [stdlib] build SwiftExperimental with -parse-stdlib
fixes rdar://20260634

Swift SVN r26506
2015-03-24 23:55:54 +00:00
Graham Batty
ad8454d684 Disable ExistentialCollection on linux for now.
Pending fixes to how casting works on linux.

Swift SVN r26503
2015-03-24 23:16:50 +00:00
Dave Abrahams
d2b42a61ab [stdlib] ExistentialCollection: finish commenting.
Swift SVN r26435
2015-03-23 16:59:23 +00:00
Dave Abrahams
87ea087a2f [stdlib] ExistentialCollection: documentation
Swift SVN r26429
2015-03-23 07:01:14 +00:00
Dave Abrahams
93ff088535 [stdlib] AnyGenerator is a Sequence
Swift SVN r26427
2015-03-23 03:20:07 +00:00
Dave Abrahams
16ce901da1 [stdlib] Finish doc-commenting Mirror support
Swift SVN r26425
2015-03-23 02:44:25 +00:00
Dave Abrahams
f19791baca [stdlib] Mirror: commenting and naming
Swift SVN r26421
2015-03-23 00:42:36 +00:00
Dave Abrahams
be2d906777 [stdlib] Mirror: some commenting, one name change.
Swift SVN r26394
2015-03-21 16:46:58 +00:00
Dave Abrahams
1a6d120061 [stdlib] New Mirrors: much API cleanup
Among other things, made the constructors much more explicit to avoid
potential ambiguities between labeled and unlabeled cases.

Swift SVN r26385
2015-03-21 02:35:53 +00:00
Dave Abrahams
6af025bcaa [stdlib] NewMirrors: bring back our Schema enum
Swift SVN r26365
2015-03-20 22:34:46 +00:00
Dave Abrahams
50c6e936d4 [stdlib] NewMirrors => SwiftExperimental
Swift SVN r26359
2015-03-20 18:17:55 +00:00
Dave Abrahams
dedbc72aed [stdlib] ExistentialCollection => SwiftExperimental
This sets us up to use it in the mirrors prototype.
TODO: doc comments

Swift SVN r26314
2015-03-19 20:53:25 +00:00
Chris Lattner
20f8f09ea8 Land: <rdar://problem/19382905> improve 'if let' to support refutable patterns and untie it from optionals
This changes 'if let' conditions to take general refutable patterns, instead of
taking a irrefutable pattern and implicitly matching against an optional.

Where before you might have written:
  if let x = foo() {

you now need to write:
  if let x? = foo() {
    
The upshot of this is that you can write anything in an 'if let' that you can
write in a 'case let' in a switch statement, which is pretty general.

To aid with migration, this special cases certain really common patterns like
the above (and any other irrefutable cases, like "if let (a,b) = foo()", and
tells you where to insert the ?.  It also special cases type annotations like
"if let x : AnyObject = " since they are no longer allowed.

For transitional purposes, I have intentionally downgraded the most common
diagnostic into a warning instead of an error.  This means that you'll get:

t.swift:26:10: warning: condition requires a refutable pattern match; did you mean to match an optional?
if let a = f() {
       ^
        ?

I think this is important to stage in, because this is a pretty significant
source breaking change and not everyone internally may want to deal with it
at the same time.  I filed 20166013 to remember to upgrade this to an error.

In addition to being a nice user feature, this is a nice cleanup of the guts
of the compiler, since it eliminates the "isConditional()" bit from
PatternBindingDecl, along with the special case logic in the compiler to handle
it (which variously added and removed Optional around these things).




Swift SVN r26150
2015-03-15 07:06:22 +00:00
Dmitri Hrybenko
fae641f3cd Move readLine() to SwiftExperimental
This API did not go through API review.

Swift SVN r25904
2015-03-10 00:04:02 +00:00
Dmitri Hrybenko
b13758e6f4 Move floating point parsing APIs to SwiftExperimental
These APIs did not go through API review.

Swift SVN r25891
2015-03-09 19:04:22 +00:00
Dmitri Hrybenko
5ca75b75e3 Move integer parsing APIs to SwiftExperimental
These APIs did not go through API review.

Swift SVN r25890
2015-03-09 19:04:21 +00:00
Dmitri Hrybenko
350248dae5 Reorganize the directory structure under 'stdlib'
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.

See stdlib/{public,internal,private}/README.txt for more information.

Swift SVN r25876
2015-03-09 05:26:05 +00:00