Commit Graph

129 Commits

Author SHA1 Message Date
Dave Abrahams
2e0bb2f533 [stdlib] String index interchange, part II (UTF16) 2017-07-07 06:15:23 -07:00
Dave Abrahams
e523c80339 [stdlib] Index interchange, part I 2017-07-07 00:59:04 -07:00
Dave Abrahams
d6fee05375 [stdlib] Enable interchange among StringProtocol models 2017-05-17 17:21:43 -07:00
Ben Cohen
ea2f64cad2 [stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement (#8990)
* Give Sequence a top-level Element, constrain Iterator to match

* Remove many instances of Iterator.

* Fixed various hard-coded tests

* XFAIL a few tests that need further investigation

* Change assoc type for arrayLiteralConvertible

* Mop up remaining "better expressed as a where clause" warnings

* Fix UnicodeDecoders prototype test

* Fix UIntBuffer

* Fix hard-coded Element identifier in CSDiag

* Fix up more tests

* Account for flatMap changes
2017-05-14 06:33:25 -07:00
Nate Cook
f650e0a7da [stdlib] String and range expressions
* finish string documentation revisions
* revise examples throughout to use range expressions instead of e.g.
  prefix(upTo: _)
2017-05-13 10:06:12 -05:00
Dave Abrahams
ddf7ad517f UnicodeScalar => Unicode.Scalar 2017-05-11 15:23:25 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Nate Cook
c2bc72d9d6 [stdlib] Fix string index sharing (#4896)
* [stdlib] Fix String.UTF16View index sharing

* [stdlib] Fix String.UnicodeScalarView index sharing

* [stdlib] Fix String.CharacterView index sharing

* [stdlib] Test advancing string indices past their ends

* [stdlib] Simplify CharacterView ranged subscript
2016-10-13 10:19:38 -07:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00
Dmitri Gribenko
d1801be1ef stdlib: add a couple of ABI FIXMEs to String implementation
We should not make grapheme segmentation algorithm inlineable now (and
possibly ever).  The immediate reason is that Unicode 8.0 grapheme
segmentation algorithm has been changed significantly in Unicode 9.0.
Unicode 9.0 requires a stateful algorithm.  Current indices and
iterators just don't have the storage for that state, so we can't mark
them as fragile.
2016-08-10 18:05:29 -07:00
Andrew Trick
9886e4ef54 Use UnsafeRawPointer in StringCore.
This is another necessary step in introducing changes
for SE-0107: UnsafeRawPointer.

UnsafeRawPointer is great for bytewise pointer operations.

OpaquePointer goes away.

The _RawByte type goes away.

StringBuffer always binds memory to the correct CodeUnit
when allocating memory.

Before accessing the string, a dynamic element width check
allows us to assume the bound memory type.

Generic entry points like atomicCompareExchange no longer handle
both kinds of pointers. Normally that's good because you
should not be using generics in that case, just upcast
to raw pointer. However, with pointers-to-pointers
you can't do that.
2016-07-27 09:07:35 -07:00
Xin Tong
9709b0e510 Merge pull request #3662 from trentxintong/unicodescalar
SE-0128 - Change unicodescalar initializer to failable
2016-07-26 16:44:14 -07:00
Xin Tong
bbf86865d6 Change unicodescalar to failable
We were using a precondition which crashes the program when invalid input is
provided. We want to provide a way to gracefully check and handle invalid input
or shutdown the program if necessary.

SR-1930
2016-07-21 15:27:13 -07:00
Doug Gregor
0bf7c005b3 [SE-0091 Follow-up] Move global operators for non-generic concrete types into the type.
In various cases where we had global operators for non-generic
concrete types (such as String + String), move those operators into
the type. This should not affect the sources, but makes the exposition
of the library cleaner.

Plus, it's a good test for the compiler, which uncovered a few issues
where the compiler was coupled with the library.
2016-07-21 12:54:27 -07:00
Nate Cook
c9278a1b50 [stdlib] Remove _StringCore from UTF8View.Index 2016-07-12 09:29:40 -05:00
Dmitri Gribenko
ce94bd9cca Merge pull request #3268 from natecook1000/nc-scalarindex-nocore
[stdlib] Remove _StringCore from UnicodeScalarIndex
2016-07-07 17:41:36 -07:00
Nate Cook
2d75c12c2d [stdlib] Remove _StringCore reference from UnicodeScalarIndex
This removes the `_core` property from UnicodeScalarView.Index
and moves any remaining index-moving logic from the index to
the view in UnicodeScalarView and CharacterView.
2016-07-02 23:16:22 -05:00
practicalswift
5d1af107a3 [gardening] Use "{let,var} c: C" instead of "{let,var} c : C"
Inspired by @gribozavr:s fix in 1ad666742e
2016-07-01 23:51:32 +02:00
practicalswift
af9786efc2 [gardening] Remove duplicate words. 2016-06-04 23:16:27 +02:00
Rintaro Ishizaki
668b9dbc64 [stdlib] Apply tail style "where" clause to stdlib/public/core 2016-06-02 12:00:55 +09:00
Patrick Pijnappel
daec2dae00 Resolve conflicts with master 2016-05-24 19:21:04 +02:00
Nate Cook
44b2d56a7f [stdlib] Revise documentation for string-related types
This documentation revision covers a large number of types & protocols:
String, its views and their indices, the Unicode codec types and protocol,
as well as Character, UnicodeScalar, and StaticString, among others.

This also includes a few small changes across the standard library for
consistency.
2016-05-22 03:04:22 -05:00
Dmitri Gribenko
d591f9cf7a stdlib: remove most uses of @warn_unused_result, which does nothing now
I kept the one on sorted(), because that one requires a less trivial
change.
2016-05-19 18:39:39 -07:00
Patrick Pijnappel
4419614be4 Move post-nil guarantee to separate line for Iterators' next() 2016-05-08 21:36:39 +02:00
Patrick Pijnappel
ab9e74cba3 Resolve conflicts with upstream 2016-05-05 08:55:34 +02:00
Dave Abrahams
9bee5d182f [stdlib] location/formLocation => index/formIndex 2016-04-26 17:46:16 -07:00
Max Moiseev
e733a9b194 [stdlib][swift-3-indexing-model] removing successor/predecessor from String.UnicodeScalarView.Index 2016-04-25 11:55:10 -07:00
Dave Abrahams
47a870cc50 [stdlib] Use location/formLocation for all index movement 2016-04-21 17:13:41 -07:00
Dmitri Gribenko
10697f939f Merge commit '510f29abf77e202780c11d5f6c7449313c819030' into swift-3-indexing-model 2016-04-14 13:45:27 -07:00
Nate Cook
3522af5bd5 [New indexing model] Switch old index methods to internal 2016-04-08 14:04:34 -05:00
Nate Cook
6b77c6a979 [New indexing model] Update documentation comments with new APIs
Most of these were successor() -> successor(of:).
2016-04-08 01:01:58 -05:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Dmitri Gribenko
6985b958fd Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-04 11:42:17 -07:00
Dmitri Gribenko
5a12349e9c Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-01 14:12:13 -07:00
Slava Pestov
7b91cbd551 stdlib: Add @_versioned attributes needed for resilient build 2016-04-01 13:07:18 -07:00
Erik Eckstein
c0964a492d Re-instate "stdlib: Add some inlining attributes to help the optimizer getting the right inlining decisions."
This re-instates commit 8b0e36779e
2016-03-29 16:33:47 -07:00
Erik Eckstein
be8faad792 Revert my recent inliner commits.
There are some failures in the tests.
2016-03-28 11:11:25 -07:00
Erik Eckstein
8b0e36779e stdlib: Add some inlining attributes to help the optimizer getting the right inlining decisions.
This is more or less a workaround for some optimizations (mainly ARC opt) to avoid performance degradation with the upcoming inliner changes
In some situations it makes a big difference for ARC opt if a function is inlined or not, althought this shouldn't be the case.
2016-03-27 10:59:29 -07:00
Dave Abrahams
8d9e62b274 [stdlib] indexing model: rename next/previous
I'm not too satisfied with the names for the updating: versions, but
this is a start.
2016-03-22 17:13:54 -07:00
Dave Abrahams
f493b54e44 [stdlib] indexing model: Interval/Range merge
This is step 1; we still need to introduce ClosedRange.
2016-03-16 15:59:10 -07:00
Patrick Pijnappel
07a8c39fcb [stdlib] Use double space as sentence separator in IteratorType.next() docs. 2016-03-16 22:36:26 +11:00
Patrick Pijnappel
020841d4ba [stdlib] Add post-nil guarantee for IteratorProtocol.next() to always return nil 2016-03-16 22:06:07 +11:00
Dmitri Gribenko
3bb845a16a New indexing model: implement temporary forwarders in UnicodeScalarView 2016-03-11 18:06:12 -08:00
Dmitri Gribenko
cfab2d17c4 New indexing model: fix compilation issues in String 2016-03-09 14:31:31 -08:00
Dmitri Gribenko
41f3cf8b55 New indexing model: comment out a conflicting '..<' operator that produces HalfOpenInterval 2016-03-08 01:38:56 -08:00
Shawn Erickson
2a69d24688 fleshed out BidirectionalCollection previous(Index) and friends 2016-03-07 09:38:41 -08:00
Shawn Erickson
0db3a29987 fleshing out Collection.next(Index)
-removed fatal stub Collection.next(Index)
-added default Collection.next(Index) where Index is Strideable
-added custom next(Index) on some collections
-added fatal stub next(Index) on some collections
2016-03-06 17:37:40 -08:00
Dmitri Gribenko
fc636b94f5 fixup 2016-03-06 02:12:59 -08:00
Dmitri Gribenko
ad1428e1d6 New collection indexing model: removed old index protocols
... and started to fix compiler errors.
2016-03-06 01:53:34 -08:00