Commit Graph

3744 Commits

Author SHA1 Message Date
Károly Lőrentey
826f8daf4a [stdlib] _lowUWord => _lowWord 2017-07-10 22:40:52 +02:00
Károly Lőrentey
c8d4fd4242 [stdlib] Remove BinaryInteger._word(at:)
Removes BinaryInteger's _word(at:) requirement and its
countOfRepresentedWords property, making the words property the
sole way to access an integer's words.

This is a better fix for https://bugs.swift.org/browse/SR-5275.
2017-07-10 22:40:52 +02:00
Michael Gottesman
62ece7e07d [semantic-sil] Turn on sil ownership/the verifier by default on stdlibCore.
rdar://31880847
2017-07-10 13:39:08 -07:00
Károly Lőrentey
7836268d45 [stdlib] Implement BinaryInteger.words in standard integer types.
Introduces the following new collection types as lightweight
views of a corresponding integer value:

- UInt.Words
- UInt64.Words (on 32-bit platforms)
- DoubleWidth.Words

The rest of the standard integer types define Words as a typealias
to one of the first two of these, based on their width.
2017-07-10 19:03:34 +02:00
Xi Ge
82d9ec4634 [stdlib] Attaching document comment properly to AnyObject. NFC (#10817) 2017-07-07 16:01:47 -07:00
Max Moiseev
5f1c3f7021 [overlay] Generalize Foundation StringProtocol extensions 2017-07-07 15:34:56 -07:00
Xiaodi Wu
2c29408430 Merge branch 'master' into silence-warnings 2017-07-07 17:33:55 -05:00
Dave Abrahams
076b2e115f Merge pull request #10814 from apple/index-interchange
Index interchange
2017-07-07 15:01:17 -07:00
Joe Groff
8793212293 Merge pull request #10741 from jckarter/key-path-generic-computed
Handle generic computed properties in key paths.
2017-07-07 13:50:27 -07:00
Dave Abrahams
9159239995 Un-revert "[stdlib] String index interchange, etc." (#10812)
I failed to merge the upstream changes to swift-corelibs-foundation at the same
time as I merged that #9806, and it broke on linux. Going to get it right this
time.
2017-07-07 12:13:25 -07:00
Xi Ge
d9fb110674 Revert "[stdlib] String index interchange, etc." (#10812)
rdar://33186295
2017-07-07 12:03:16 -07:00
Dave Abrahams
0a483187b1 Merge pull request #10740 from apple/fix-unsafebufferpointer-_copyContents
[stdlib] Correct UnsafeBufferPointer._copyContents
2017-07-07 10:39:22 -07:00
swift-ci
844cce79cb Merge pull request #10809 from uunlu/master 2017-07-07 09:27:19 -07:00
Ugur Unlu
f441f53e65 [stdlib] Correct UnsafeRawPointer.bindMemory example 2017-07-07 15:29:03 +02:00
Dave Abrahams
283775ed1f [stdlib] Rebuild String.Index for UTF8View 2017-07-07 06:15:26 -07:00
Dave Abrahams
576b8de64a [stdlib] Speed String.UTF8View.count even more 2017-07-07 06:15:26 -07:00
Dave Abrahams
cf09e6b383 [stdlib] UTF8View: count by iterating
The fancy code didn't turn out to be any faster.
2017-07-07 06:15:26 -07:00
Dave Abrahams
dd3fb9b71d [stdlib] Small correction to UTF8 Iterator
This works either way I suppose, but the code is clearer now.
2017-07-07 06:15:25 -07:00
Dave Abrahams
189f1660fd [stdlib] Foundation SPI fixup 2017-07-07 06:15:25 -07:00
Dave Abrahams
b21fa4575a [stdlib] UTF8View Iterator and count specialization 2017-07-07 06:15:25 -07:00
Dave Abrahams
d94297ced1 [stdlib] Bring back some SPI that Foundation-on-linux uses. 2017-07-07 06:15:24 -07:00
Nate Cook
b9f3a2ae47 [stdlib] Minimal docs for the new string index 2017-07-07 06:15:24 -07:00
Dave Abrahams
b1d2f4c68e [stdlib] String index interchange, part III (UTF8) 2017-07-07 06:15:24 -07:00
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
Joe Groff
c142e7d953 KeyPaths: Support captured arguments in computed components.
A necessary precursor to supporting subscripts and unspecialized generic accessors in general. Give get/set components the ability to have an "argument" area that gets instantiated by copying out of the key path pattern arguments at instantiation time, and which holds "witness" information for how to copy, destroy, equate, and hash arguments.
2017-07-06 20:07:41 -07:00
Xiaodi Wu
5d731c8a93 Make a fix-up to account for operator precedence 2017-07-06 20:01:09 -05:00
Maxim Moiseev
764d7d42fb Merge pull request #10791 from moiseev/no-rrc-string
[stdlib] StringProtocol no longer refines RangeReplaceableCollection
2017-07-06 13:48:19 -07:00
Max Moiseev
1a1c1a0d21 [stdlib] StringProtocol no longer refines RangeReplaceableCollection
https://bugs.swift.org/browse/SR-5379
2017-07-06 09:40:10 -07:00
Xiaodi Wu
3528479730 Silence compiler warnings 2017-07-05 23:56:44 -05:00
Xiaodi Wu
6ae074acfa [stdlib] Silence a compiler warning [NFC]
This PR updates `_FixedArray${N}` to conform to `ExpressibleByIntegerLiteral` rather than `IntegerLiteralConvertible`. This silences a compiler warning (actually, several).
2017-07-05 20:11:52 -05:00
Itai Ferber
a8ba0772cd Merge pull request #10728 from itaiferber/non-optional-coding-paths
Make coding paths non-optional [DO NOT MERGE]
2017-07-01 14:34:40 -07:00
Dave Abrahams
dc904d1378 [stdlib] Drop a premature @inline(__always) 2017-06-30 19:33:05 -07:00
Dave Abrahams
4ff733202a [stdlib] Correct UnsafeBufferPointer._copyContents
The implementation imposed stricter requirements on its inputs than those allowed by Sequence
2017-06-30 19:28:05 -07:00
Michael Ilseman
091738cf97 Merge pull request #10693 from milseman/zalgorithmic_complexity
[stdlib] Update non-contiguous NSStrings to Unicode 9
2017-06-30 14:13:39 -07:00
Itai Ferber
e1007a2e3b Make coding paths non-optional
For the benefit of unkeyed containers, coding paths currently contain optional `CodingKey`s — unkeyed containers are allowed to report a `nil` key in a path. However, this is unhelpful for debugging purposes, or inspecting the coding path for context, since any unkeyed container simply reports `nil`, whether it’s at index 1 or 1000.

Now all containers are required to report a non-optional CodingKey for their segment of the coding path, and coding paths are now exposed as `[CodingKey]`.
2017-06-30 12:43:40 -07:00
Itai Ferber
aa91b7273d Merge pull request #10667 from itaiferber/codable-encode-decode-nil-changes
Optionality updates to Codable API
2017-06-29 13:15:25 -07:00
Itai Ferber
b40c0bd3db Merge pull request #10685 from itaiferber/codingerror-bridging-and-conveniences
EncodingError/DecodingError bridging fixes and conveniences
2017-06-29 10:05:35 -07:00
Michael Ilseman
a3e892fca5 [stdlib] Relax ephemeralString sanity check
Creating an ephemeral string from a non-contiguous substring does not
reuse the same storage. Relax a sanity check assuming that it did.
2017-06-28 15:48:17 -07:00
Michael Ilseman
5bc20cba08 [stdlib] Clean up non-contiguous string grapheme breaking code.
Removes the legacy grapheme breaking code paths. Simplifies and
clarifies the non-contiguous grapheme breaking code through consistent
naming and handling of absolute positions vs relative offsets.
2017-06-28 15:46:44 -07:00
Michael Ilseman
b3b28e0c50 [gardening] 80 columns; NFC 2017-06-28 15:46:39 -07:00
Michael Ilseman
a37a823e6e [stdlib] Update non-contiguous NSStrings to Unicode 9
This adds Unicode 9 grapheme breaking support for non-contiguous
NSStrings. Non-contiguous NSStrings that don't hit our fast paths are
very rare, but should still behave identically to contiguous
strings.

We first copy a fixed number of code units into a fixed size buffer
(currently 16 in size) and try to grapheme break inside of that
buffer. This is sufficient storage for all known non-pathological
graphemes. Any graphemes larger than the buffer are handled by copying
larger portions of the string into an Array.

Test cases added, including pathological "zalgo" text that stresses
extremely long graphemes.
2017-06-28 15:35:25 -07:00
Itai Ferber
f088cfbdfe Add DecodingError.dataCorrupted conveniences
DecodingError.dataCorrupted is an error most commonly thrown from user code. We can expose conveniences to more easily throw .dataCorrupted errors.
2017-06-28 14:34:35 -07:00
Itai Ferber
92fccf964b Fix coding error bridging to NSError
CustomNSError briding only works when the CustomNSError conformance is in the same module as the original error declaration. We need to sink these down into the standard library.
2017-06-28 14:33:15 -07:00
Itai Ferber
8f38678911 Expose underlyingError on coding errors
Some errors are caused by others — this allows us to expose the underlying problem.
2017-06-28 14:31:53 -07:00
swift-ci
4830841139 Merge pull request #10359 from CodaFi/cygni-imperator 2017-06-28 14:00:26 -07:00
Robert Widmann
0cf1b52452 Treat Cygwin as a separate OS
Cygwin is considered a distinct target with a distinct ABI, environment
conditions, and data types.  Though the goal of the project is
native Windows integration with UNIX-likes, that is not compatible with
the idea that the platform can be ignored as Win-like enough to have the
existing os(Windows) condition apply.
2017-06-28 13:31:05 -07:00
Michael Ilseman
424bbdf6ca [stdlib] Add an internal utility fixed-size array struct.
Adds a internal-only fixed size array, which we will be using in
String as a buffer of code units. This is basically just a wrapper
around a tuple that provides a random access collection
interface. This is gyb-ed up to scale up to arbitrary sizes, as
specified by the "sizes" gyb variable.
2017-06-28 13:26:21 -07:00
Itai Ferber
60b6faaae2 Add new nil encoding methods to containers
* Add encodeNil(forKey:)/encodeNil() for keyed/unkeyed encoding
  containers
* Add decodeNil(forKey:)/decodeNil() for keyed/unkeyed decoding
  containers
* Give default implementation of decodeIfPresent(forKey:)/
  decodeIfPresent(_:) on keyed/unkeyed decoding containers instead of
  decode(forKey:)/decode(_:)
* Expose all encode/decode methods on keyed encoding & decoding
  containers to allow overriding default methods (which were previously
  not forwarding)
2017-06-28 10:10:21 -07:00
Michael Ilseman
4c0ba61e53 [gardening] Remove done TODO comments 2017-06-27 20:37:16 -07:00