Commit Graph

2952 Commits

Author SHA1 Message Date
Dmitri Hrybenko
61d622226a Revert "Generate an empty Mirror for Mirror itself - the internal cruft of our reflection magic is not that interesting, and looks quite ugly in playgrounds"
This reverts commit r28141.  It broke the build.

Swift SVN r28143
2015-05-05 00:40:49 +00:00
Enrico Granata
6fcc3081ac Generate an empty Mirror for Mirror itself - the internal cruft of our reflection magic is not that interesting, and looks quite ugly in playgrounds
Swift SVN r28141
2015-05-05 00:18:42 +00:00
Chris Lattner
079e8b982b move stdlib from let/else to require.
Swift SVN r28098
2015-05-03 21:45:06 +00:00
Dmitri Hrybenko
e340bf410c stdlib: fix coding style
Swift SVN r28094
2015-05-03 04:10:59 +00:00
Dave Abrahams
bdc1e10362 [stdlib] 80-column fixups
Swift SVN r28078
2015-05-02 04:50:38 +00:00
Dave Abrahams
68b4314d47 [stdlib] Move String.CharacterView's implementation...
...into its own file.

Swift SVN r28077
2015-05-02 04:50:37 +00:00
Dave Abrahams
1198e2aa7a [stdlib] Fix a bug I committed.
Swift SVN r28076
2015-05-02 04:41:43 +00:00
Dave Abrahams
1947d705b5 [stdlib] add some // @testable comments...
...to public declarations that are accessible only for testing purposes

Swift SVN r28074
2015-05-02 04:33:13 +00:00
Dave Abrahams
5d1da8d350 [stdlib] Update String doc comments...
...for the addition of CharacterView

Swift SVN r28073
2015-05-02 04:33:12 +00:00
Dave Abrahams
8782859b91 [stdlib] Add a caveat to doc comment
Swift SVN r28072
2015-05-02 04:33:11 +00:00
Dave Abrahams
4ce1891cae [stdlib] String is no longer a SequenceType
<rdar://20494686>

String itsef should only expose Unicode-correct algorithms, like proper
substring/prefix/suffix search, enumerating words/lines/paragraphs, case
folding etc. Promoting sequence-centric algorithms to methods on String
is not acceptable since it invites users to write wrong code. Thus,
String has to lose its SequenceType conformance.

Nevertheless, we recognize that sometimes it is useful to manipulate the
String contents on lower levels (UTF-8, UTF-16, Unicode scalars,
extended grapheme clusters), for example, when implementing high-level
Unicode operations, so we can't remove low-level operations
altogether. For this reason, String provides nested "views" for the
first three low-level representations, but grapheme clusters were in a
privileged position -- String itself is a collection of grapheme
clusters. We propose to add a characters view that will represent the
String as a collection of Character values.

Swift SVN r28065
2015-05-02 01:52:02 +00:00
Andrew Trick
5bc23acf75 Add wrappers around Builtin.isUnique.
Currently they do nothing but allow stdlib code to use regular (Bool)
types.  However, soon the wrappers for the _native variants will
provide point-of-use sanity checking.

These need to be fully generic to support class protocols and
single-payload enums (not just for optional). It also avoids a massive
amount of overloading for all the reference type variations
(AnyObject, Native, Unknown, Bridge) x 2 for optional versions of
each.

Because the wrapper is generic, type checking had to be deferred until
IRGen. Generating code for the wrapper itself will result in an
IRGen-time type error. They need to be transparent anyway for proper
diagnostics, but also must be internal.

Note that the similar external API type checks ok because it
forces conformance to AnyObject.

The sanity checks are disabled because our current facilities for
unsafe type casting are incomplete and unsound. SILCombine can
remove UnsafeMutablePointer and RawPointer casts by assuming layout
compatibility. IRGen will later discover layout incompatibility and
generate a trap.

I'll send out a proposal for improving the casting situation so we can
get the sanity checks back.

Swift SVN r28057
2015-05-01 23:45:44 +00:00
David Farler
91c64fdbb1 Stop re-exporting the Objective-C library
and link it properly. This is needed to embed LLVM bitcode sections
in the standard library and overlays. The linker doesn't support
embedded bitcode and reexport flags (among others).

rdar://problem/20750099

Swift SVN r28052
2015-05-01 22:24:14 +00:00
Dmitri Hrybenko
b2f1ffbe51 stdlib: constrain CollectionType.SubSlice further
The blocking compiler bug was fixed.

Swift SVN r28038
2015-05-01 09:34:34 +00:00
Ted Kremenek
9f5437e2bc Make 'toInt()' unavailable instead of deprecated.
Swift SVN r28029
2015-05-01 06:25:52 +00:00
Devin Coughlin
0c82636156 Runtime: Enable run-time availability checks for tvOS
Change _stdlib_isOSVersionAtLeast on tvOS to actually check the running
OS version rather than always returning false. It still always returns false on
watchOS; rdar://problem/20234735 tracks that.

rdar://problem/20663303

Swift SVN r28024
2015-05-01 05:10:47 +00:00
Ted Kremenek
5a5454569f Make deprecated protocols 'Printable' and 'DebugPrintable' unavailable.
Swift SVN r28020
2015-05-01 04:14:50 +00:00
Dave Abrahams
afd9e2bb78 [stdlib] Fix comment typo
Swift SVN r27984
2015-04-30 17:46:58 +00:00
Doug Gregor
a3541643ec Switch name lookup over to the protocol conformance table.
More of rdar://problem/18448811.

Swift SVN r27969
2015-04-30 16:13:38 +00:00
Erik Eckstein
3ad2b6710b stdlib: add @_semantics("availability.osversion") to _stdlib_isOSVersionAtLeast
Needed by GlobalOpt (rdar://problem/20708979)



Swift SVN r27963
2015-04-30 11:05:31 +00:00
Chris Lattner
31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00
Dmitri Hrybenko
ffc6f62b93 stdlib: doc comments: clarify the behavior of algorithms on SequenceType
These clarifications were requested in API review.

Swift SVN r27951
2015-04-30 00:27:49 +00:00
Andrew Trick
ec31f6dbc9 Revert "Add wrappers around Builtin.isUnique."
This reverts commit 64e9f11211a19fa603f5bc2d2bea171a9b07d3fa.

I think this is breaking ExistentialCollection test in the
Release + stdlib asserts build.

Swift SVN r27947
2015-04-29 23:23:13 +00:00
Dmitri Hrybenko
16ab7b4a3b stdlib: rename equalElements() to elementsEqual() per API review
Swift SVN r27937
2015-04-29 22:34:59 +00:00
Dave Abrahams
d576eb9e63 [stdlib] Merge experimental inheritance support for mirrors
Swift SVN r27934
2015-04-29 22:21:46 +00:00
Dave Abrahams
27448f174f [stdlib] == and != for metatypes and optional metatypes
Swift SVN r27933
2015-04-29 22:19:01 +00:00
Andrew Trick
09db0dda92 Add wrappers around Builtin.isUnique.
The wrappers for the _native variants provide point-of-use sanity checking.
They also allows stdlib code to use regular (Bool) types.

These need to be fully generic to support class protocols. It also
avoids a massive amount of overloading for all the reference type
variations (AnyObject, Native, Unknown, Bridge) x 2 for optional
versions of each.

Because the wrapper is generic, type checking had to be deferred until
IRGen. Generating code for the wrapper itself will result in an
IRGen-time type error. They need to be transparent anyway for proper
diagnostics, but also must be internal.

The external API passes type checks because it forces conformance to AnyObject.

Swift SVN r27930
2015-04-29 21:59:19 +00:00
Andrew Trick
9ec8fe58ca Convert stdlib classes to use Builtin.isUnique.
Fixes <rdar://problem/18151694> Add Builtin.checkUnique to avoid lost Array copies

The isUniquelyReference APIs are now correct in the presence of full
inlining and ARC optimization. The ARC optimizer can't see into the
Builtin, which lowers to a special SIL instruction.

Swift SVN r27929
2015-04-29 21:59:17 +00:00
Dmitri Hrybenko
ea8f2de15a stdlib: use let-else in zip() implementation
Swift SVN r27927
2015-04-29 21:51:47 +00:00
Dmitri Hrybenko
d8c140f228 stdlib/Zip: use more descriptive names for non-API identifiers
Swift SVN r27926
2015-04-29 21:51:44 +00:00
Dmitri Hrybenko
be05690856 Revert "stdlib/Zip: use more descriptive names for non-API identifiers"
This reverts commit r27922.  I didn't update all use sites.

Swift SVN r27924
2015-04-29 21:31:36 +00:00
Dmitri Hrybenko
1551fd01af stdlib/Zip: use more descriptive names for non-API identifiers
Swift SVN r27922
2015-04-29 21:30:02 +00:00
Dmitri Hrybenko
70d728efef stdlib: remove the staged API changes for zip()
API review has reached consensus that zip() reads better as a free
function.

Swift SVN r27921
2015-04-29 21:30:02 +00:00
Ted Kremenek
ea498e9fef Revert "[stdlib] Merge experimental inheritance support for mirrors"
This is breaking the Jenkins build.

Swift SVN r27919
2015-04-29 20:27:36 +00:00
Dave Abrahams
9407cc5ab8 [stdlib] Merge experimental inheritance support for mirrors
Swift SVN r27918
2015-04-29 20:13:49 +00:00
Dmitri Hrybenko
a741b1b191 stdlib: mark Range.isEmpty for removal, it will become redundant soon
Swift SVN r27907
2015-04-29 04:24:13 +00:00
Dmitri Hrybenko
e0affbcbae stdlib: fix coding style
Swift SVN r27906
2015-04-29 04:24:13 +00:00
Dmitri Hrybenko
4d197dc5b2 Revert "stdlib: change sort() and sorted() into methods"
This reverts commits r27885, r27876.  It looks like they broke iOS on
arm64.

Swift SVN r27893
2015-04-28 23:58:50 +00:00
Dmitri Hrybenko
10430823a6 stdlib: transform the FIXME into a proper FIXME
Swift SVN r27885
2015-04-28 22:21:10 +00:00
Dmitri Hrybenko
b05c372c4f stdlib: change sort() and sorted() into methods
Swift SVN r27876
2015-04-28 18:05:37 +00:00
Dmitri Hrybenko
ff6f084b77 tests: remove -disable-access-control from Sort.swift.gyb
Swift SVN r27859
2015-04-28 04:40:59 +00:00
Dmitri Hrybenko
fd14e70e48 stdlib: rename find() to indexOf() per API review
Swift SVN r27849
2015-04-28 00:30:37 +00:00
Dmitri Hrybenko
0ef360228b stdlib: constrain CollectionType.SubSlice to _CollectionDefaultsType
The language has limitations that don't allow us to express the API we
actually want, and we have to resort to underscored protocols again.

<rdar://problem/20715009> Implement recursive protocol constraints

<rdar://problem/20477576> 'where' constraints on associated types in
protocols

Swift SVN r27820
2015-04-27 21:50:19 +00:00
Dmitri Hrybenko
6e68fd7675 stdlib: remove a FIXME that is fixed now
Swift SVN r27816
2015-04-27 19:59:17 +00:00
Dave Abrahams
e2c6c7e90d [stdlib] Fix "#" parameter warnings due to new rules
Swift SVN r27807
2015-04-27 18:15:34 +00:00
Dmitri Hrybenko
3408c00886 stdlib: fix a typo in a trap message
Swift SVN r27796
2015-04-27 01:09:33 +00:00
Dmitri Hrybenko
f6090c1c89 stdlib: make CollectionType._prext_isEmpty dynamically dispatched
This change makes isEmpty faster for Dictionary and Set, when invoked
from generic algorithms.

Swift SVN r27736
2015-04-26 00:08:14 +00:00
Dmitri Hrybenko
80dc495ad0 stdlib: fix coding style in HashedCollections
Swift SVN r27735
2015-04-26 00:08:14 +00:00
Dmitri Hrybenko
44ef30a5af stdlib: fix grammar in an error message
Swift SVN r27734
2015-04-26 00:08:13 +00:00
Dmitri Hrybenko
3a59a446ac stdlib: adjust _NSSetCoreType to match Foundation nullability audit
Swift SVN r27730
2015-04-26 00:08:11 +00:00