Commit Graph

2952 Commits

Author SHA1 Message Date
Doug Gregor
447dce6c1f Merge pull request #9004 from itaiferber/swift-archival-serialization
Swift Archival & Serialization API
2017-04-28 20:02:33 -07:00
Doug Gregor
e90b7f9655 Merge pull request #9030 from natecook1000/nc-dictionary
[stdlib] Dictionary/Set enhancements
2017-04-28 19:42:17 -07:00
Ben Cohen
946b776e37 [stdlib] One-sided ranges and RangeExpression (#8710)
* One-sided ranges and RangeExpression

* Remove redundant ClosedRange methods from String

* Fix up brittle tests

* Account for Substring update

* XFAIL range diagnostics on Linux
2017-04-28 12:59:04 -07:00
Itai Ferber
e1e67844a8 Split RawRep extensions for Encodable + Decodable
You shouldn't need to be Codable in order to get these implementations;
being either Encodable or Decodable should be enough to get the relevant
default implementation
2017-04-28 11:15:04 -07:00
swift-ci
2e6bdbc1fa Merge pull request #9078 from apple/stateful-unicode-decoding 2017-04-27 14:33:37 -07:00
Dave Abrahams
5ad4ef4508 [stdlib] UnicodeDecoders: bidirectional UnicodeScalar view
Reverse iteration over a collection is significantly slower than forward.

REVERSE_COLLECTION

user	0m4.609s
user	0m4.587s
user	0m4.585s

COLLECTION

user	0m3.423s
user	0m3.517s
user	0m3.492s
2017-04-27 14:00:18 -07:00
Itai Ferber
53d82b1923 Rename sequence type to avoid ambiguity 2017-04-27 10:22:03 -07:00
Erik Eckstein
9ac13ae606 stdlib, optimizer: add Array. reserveCapacityForAppend as a new array semantics operation.
This function reserves capacity in an Array for new elements which are about to be appended.
2017-04-27 09:06:55 -07:00
Doug Gregor
966c9b5754 [Stdlib] Remove a return statement after a fatalError().
Eliminates a warning about unreachable code because, you know, it's
unreachable code. Fixes rdar://problem/31766069.
2017-04-26 23:30:53 -07:00
Maxim Moiseev
41b00c57ab Merge pull request #9044 from moiseev/substring-in
[stdlib] Substring
2017-04-26 19:25:59 -07:00
Ben Cohen
7b0eb29db5 Undo Sequence constraint on BinaryInteger.Words (#9047) 2017-04-26 17:22:34 -07:00
Max Moiseev
f741caf04e hasSuffix and hasPrefix are not available on Linux 2017-04-26 16:15:20 -06:00
Max Moiseev
e1f502f6cd Swift 3 compatible String and Substring range subscripts 2017-04-26 12:13:43 -07:00
Nate Cook
e2328885c1 [stdlib] Dictionary/Set enhancements
A variety of enhancements from SE-154 and SE-165:

- Custom Keys and Values collections for Dictionary
- Two sequence-based Dictionary initializers
- Merging methods for Dictionary
- Capacity checking and reserving for Dictionary and Set
- Type-specific filter(_:) methods for Dictionary and Set
- A mapValues(_:) method for Dictionary
- A grouping Dictionary initializer
2017-04-26 11:21:16 -05:00
Michael Ilseman
111d6200eb Merge pull request #8979 from milseman/parse_my_tweets_faster
[stdlib] Parse my tweets faster! 2x forwards, 3x reverse
2017-04-26 07:36:18 -07:00
practicalswift
ab5aaeb359 Merge pull request #9001 from practicalswift/gardening-20170425
[gardening] Unused variables. Unused diagnostics. Namespace comments. Typos.
2017-04-26 09:28:24 +02:00
Michael Ilseman
fa61a665c5 [stdlib] Fix relative-offset computing bug in grapheme breaking.
Many of StringCore private APIs, when the StringCore is itself a
substring, expect relative offsets rather than absolute offsets. This
fixes a bug in the sub-0x300 fast path where we were using absolute
offsets. Test cases added.
2017-04-25 16:51:35 -07:00
Max Moiseev
8e55b1dd8a Adding ExpressibleBy protocol conformances to Substring 2017-04-25 15:03:26 -07:00
Max Moiseev
79f4c9c80e Making one of Substring initializers public 2017-04-25 15:02:02 -07:00
Max Moiseev
7e8f8681bf Unavailable String returning subscripts 2017-04-25 15:00:15 -07:00
Max Moiseev
2216a6360e CustomDebugStringConvertible and var characters 2017-04-25 14:59:20 -07:00
Max Moiseev
161ef05de7 Adding TextOutputStream and TextOutputStreamable conformances 2017-04-25 14:58:51 -07:00
Max Moiseev
f19b9db421 Reimplementing Substring using the RangeReplaceableBidirectionalSlice 2017-04-25 14:58:25 -07:00
Max Moiseev
b1898ab768 Porting String APIs to Subtring and fixing some tests 2017-04-25 14:58:06 -07:00
Max Moiseev
9a40996253 Introducing the Substring type 2017-04-25 14:52:46 -07:00
Max Moiseev
d6dedd2523 [stdlib] Constraining BinaryInteger.Words to Sequence at least 2017-04-25 14:35:51 -07:00
Itai Ferber
cecf00d1f1 Integrate *Codable protocols and associated types
Add Encodable and Decodable protocols, along with associated container
types, default implementations, and extensions to the standard library
2017-04-25 13:04:27 -07:00
practicalswift
ff827e0455 [gardening] Fix recently introduced typos 2017-04-25 21:03:44 +02:00
Maxim Moiseev
13abb9a0a7 [stdlib] BinaryInteger func word(at:) => var words: Words (#8984)
* [stdlib] Underscoring BinaryInteger.word(at:)

* [stdlib] Implementing var words in terms of _word(at:)
2017-04-25 08:45:01 -07:00
swift-ci
c5f47670ac Merge pull request #8963 from aschwaighofer/stdlib_resilience_bitwidth_inlineable 2017-04-25 04:19:30 -07:00
Slava Pestov
7e3f17c0c8 Keypaths: Remove workaround for rdar://problem/31749245 2017-04-25 03:32:52 -07:00
Maxim Moiseev
0f142591e3 [stdlib] Making BitwiseOperations typealias public 2017-04-24 15:32:14 -07:00
Michael Ilseman
2d8164e552 [stdlib] Parse my tweets faster! 2x forwards, 3x reverse
Adds in a special case grapheme break detection between two values
within scalar ranges where we have special knowledge. Any sub-0x300
scalars, except CR-LF, are guaranteed to have grapheme breaks between
them. We're reasonably confident this will not change in future
versions of Unicode. We might add more ranges in the future, but
should do so conservatively, anticipating future Unicode changes.

In these cases we can very quickly break, even for strings that have
mixed latin and emoji characters. In a ASCII string with a single
emoji in it, we traverse the string 2x faster forwards and 3x faster
in reverse. (Reverse is 3x faster as it involves some forwards
traversal inside of the index). For a string that's half Latin half
non-Latin, we're about 1.5x faster forwards and backwards.
2017-04-24 15:17:25 -07:00
Arnold Schwaighofer
915c066dac [stdlib/resilience] Mark FixedWidthInteger.bitwidth as inlinable
Fixes test/IRGen/enum_derived.swift test case in resilient mode.

rdar://31757974
2017-04-24 13:47:57 -07:00
swift-ci
cd262be2c6 Merge pull request #8955 from DougGregor/associated-type-override-hints 2017-04-24 09:11:38 -07:00
Doug Gregor
225a26d25d [Stdlib] Don't redeclare the Magnitude associated type unnecessarily.
Just use a where clause on the protocol to add requirements.
2017-04-24 08:11:22 -07:00
Maxim Moiseev
1c1b2b966d [stdlib] String : RangeReplaceableCollection & BidirectionalCollection (#8921)
* [stdlib] String : RangeReplaceableCollection & BidirectionalCollection

* Add source compatibility hack for Swift.max

* Add source compatibility hack for Swift.min

* Remove redundant conformance in benchmarks

* Fix stupid typo I thought I'd already pushed

* XFAIL testing now-redundant conformance

* XFAIL an IDE test for now
2017-04-23 20:04:54 -07:00
Slava Pestov
8a0b4b0c5c Keypaths: Remove workaround for rdar://problem/31725007 2017-04-23 01:49:02 -07:00
swift-ci
da909998a2 Merge pull request #8673 from apple/empty-collection-debugPrecondition 2017-04-22 21:55:33 -07:00
swift-ci
1817776574 Merge pull request #8837 from natecook1000/nc-fixes-74-1 2017-04-22 20:38:54 -07:00
Andrew Bennett
ca31338e49 Simplifying implementation of ExpressibleByStringLiteral (#7125)
* Simplify conforming to ExpressibleByStringLiteral with default implementations

* attributes on default implementations

* ExpressibleByUnicodeScalarLiteral validation test

* more generic default implementations

* clean up test

* remove unneeded implementations

* remove test verification

* indent

* revert @effects and affected methods

* fix test generics with _ protocols

* Add semantic tests

* clean up tests

* Fix redundant conformance requirements
2017-04-21 20:45:28 -07:00
Joe Groff
3d178be169 Merge pull request #8875 from jckarter/keypaths
Keypaths
2017-04-21 17:51:17 -07:00
Ben Cohen
9733d50db4 Add Swift 3 compatibility versions of String.init for Signed/UnsignedInteger (#8926) 2017-04-21 17:30:31 -07:00
Joe Groff
d5cdf658da KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths. 2017-04-21 16:56:17 -07:00
Ben Cohen
5494424b9a Correct UnsafeBufferPointer's Collection.makeIterator, add _copyContents (#8902) 2017-04-21 15:53:51 -07:00
Michael Ilseman
659260d5a0 Merge pull request #8870 from milseman/string_character_iteration
[stdlib] Speed up char iteration on ASCII strings.
2017-04-21 11:48:55 -07:00
swift-ci
a477006cb9 Merge pull request #8884 from apple/clean-up-warnings 2017-04-20 19:49:26 -07:00
Joe Groff
fd8d488662 Work around an optimizer bug with inlining generic functions invoked with opened archetypes (rdar://problem/31749245) 2017-04-20 19:21:16 -07:00
swift-ci
42c150cfb7 Merge pull request #8900 from DougGregor/lazy-filter-index 2017-04-20 17:31:19 -07:00
Michael Ilseman
87e0076272 [stdlib] un-_fastPath ASCII path, it implies coldness of other branch
By removing the _fastPath inside of grapheme breaking, we avoid
cooling off all the other blocks in the function, restoring
performance parity with before the ASCII special case logic. This does
not meaningfully impact the performance of the special case, so we are
still about 2-3x faster iterating forwards and backwards over ASCII
characters than before.
2017-04-20 16:53:53 -07:00