Commit Graph

8969 Commits

Author SHA1 Message Date
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
Michael Ilseman
56debbc395 Merge pull request #10648 from milseman/unicode_punk_shoe_a_shun
[String] Grapheme fast paths for punctuation: 5-8x speedup.
2017-06-28 13:09:27 -07:00
Itai Ferber
baca811820 Ensure values are decodable from nil
* Eliminate null checks from unboxing in the general case (so types
  can at least attempt to decode from nil)
* Add unit tests to confirm this behavior
2017-06-28 11:23:22 -07:00
Maxim Moiseev
a2b89a7a2d Merge pull request #10585 from moiseev/modelio-overlay
[overlay] Add ModelIO overlay
2017-06-28 10:11:53 -07:00
Itai Ferber
692a893e16 Allow superDecoder to wrap null values
* Update {JSON,PropertyList}Decoder to allow superDecoder()s to wrap
  null value so current implementations of collections can decode
  contained objects from nil
2017-06-28 10:10:21 -07:00
Itai Ferber
bf1d2a745e Accessibility cleanup in {JSON,Plist}Encoder
To make it slightly easier to tell at a glance if a method is
implemented as part of API (public/open), shared implementation detail
(fileprivate), or implementation detail meaningful only to a given type
(private).
2017-06-28 10:10:21 -07:00
Itai Ferber
0a0e6b7397 Update PlistEncoder with proposed nil changes
* Add encodeNil/decodeNil variants on keyed and unkeyed containers
* Give implementations of decode() variants instead of decodeIfPresent()
2017-06-28 10:10:21 -07:00
Itai Ferber
f20d4425e5 Update JSONEncoder with proposed nil changes
* Add encodeNil/decodeNil variants on keyed and unkeyed containers
* Give implementations of decode() variants instead of decodeIfPresent()
2017-06-28 10:10: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
Kuba (Brecka) Mracek
150696f8f6 On Linux, make swift_reportError always print backtraces (#10638)
On Linux, make swift_reportError always print backtraces.
2017-06-27 21:53:55 -07:00
Michael Ilseman
4c0ba61e53 [gardening] Remove done TODO comments 2017-06-27 20:37:16 -07:00
Michael Ilseman
bd5189c25a [String] Grapheme fast paths for punctuation: 5-8x speedup.
Many strings use non-sub-300 punctuation characters (e.g. unicode
hyphen, CJK quotes, etc). This can cause switching between fast and
slow paths for grapheme breaking. Add in fast-paths for general
punctuation characters and CJK punctuation and symbol characters.

This results in about a 5-8x speedup for heavily (unicode) punctuated
Latiny and CJKy workloads.
2017-06-27 19:18:51 -07:00
swift-ci
e2327f62a2 Merge pull request #10619 from ianpartridge/patch-1 2017-06-27 10:01:45 -07:00
Maxim Moiseev
59c5e5623f Merge pull request #10598 from moiseev/dispatch-oneshot
[overlay] Rename scheduleOneShot and scheduleRepeating
2017-06-27 09:44:23 -07:00
Ian Partridge
ad2311d9e2 PropertyListEncoder: Typo in documentation of encode<Value>(Value) 2017-06-27 10:24:25 +01:00
Ian Partridge
399caebf11 JSONEncoder: Typo in documentation of encode<T>(T) 2017-06-27 10:18:08 +01:00
Philippe Hausler
e5504cdf15 [Foundation] slices of slices that use range expressions incorrectly calculated relative indexing 2017-06-26 16:35:40 -07:00
Joe Groff
d07441651f Merge pull request #10556 from jckarter/key-path-optionals
KeyPaths: Add support for optional chaining/forcing components.
2017-06-26 18:57:42 -04:00
Max Moiseev
eaf20b23ba [overlay] Rename scheduleOneShot and scheduleRepeating
rdar://29587696
2017-06-26 15:38:21 -07:00
Max Moiseev
9cd60fa2ae [overlay] Adding ModelIO dependency to GLKit overlay 2017-06-26 15:26:38 -07:00
Maxim Moiseev
1fc6db7e68 Merge pull request #10551 from moiseev/inparameter
[overlay] Introducing INParameter
2017-06-26 14:27:59 -07:00
Nate Cook
1bae49950e Merge pull request #10491 from lorentey/sequence-doc-fix
[stdlib] Fix docs on Sequence.Iterator, .Element
2017-06-26 15:32:29 -05:00
wmattelaer
a724284455 [overlay] Introducing INParameter
<rdar://problem/32409847>
2017-06-26 11:21:10 -07:00
Max Moiseev
46af654271 [overlay] Add ModelIO overlay 2017-06-26 10:56:13 -07:00
Joe Groff
3c82e981f9 KeyPaths: Add support for optional chaining/forcing components.
rdar://problem/31768715
2017-06-26 09:40:31 -07:00
Antoine Cœur
3cc015bfe2 spelling 2017-06-25 10:42:21 +08:00
Itai Ferber
da27019800 Merge pull request #10539 from itaiferber/foundation-json-decimal
Encode Decimal as a numeric value in JSON
2017-06-23 15:41:51 -07:00
Itai Ferber
07d396b712 Encode Decimal as a numeric value in JSON
Allow JSONEncoder/JSONDecoder to intercept Decimal values so they get
a numeric representation in JSON (instead of their default keyed
implementation).
2017-06-23 13:02:13 -07:00
Itai Ferber
72d62af309 Merge pull request #10520 from itaiferber/foundation-shared-encoders
Allow Codable classes to share an Encoder with superclass
2017-06-23 12:48:09 -07:00
Maxim Moiseev
3c9481b4a6 Merge pull request #10521 from moiseev/intents-availability
[overlay] Fix availability in INSearchCallHistoryIntent
2017-06-23 11:06:10 -07:00
Kuba (Brecka) Mracek
8cb95b8fcd Improve reporting of @objc inference issues from the Swift runtime (#10406)
* Extend Swift runtime issue reporting for @objc inference to include details about the declaration of the method (that is missing the @objc annotation) and a suggested fix-it. This changes the ABI of RuntimeErrorDetails, so we're also bumping the version.

* Update SwiftObject.mm
2017-06-22 21:35:48 -07:00
Kuba (Brecka) Mracek
d29557bd24 Change the signature of reportToDebugger and _swift_runtime_on_report to avoid using 'bool'. It's much easier to work with native-width integers only in LLDB. (#10523) 2017-06-22 21:22:27 -07:00
Maxim Moiseev
6c4379f8b3 [overlay] Fix availability in INSearchCallHistoryIntent 2017-06-22 15:55:22 -07:00
Itai Ferber
25fc3ed34f Merge pull request #10515 from itaiferber/nskeyedarchiver-data-overloads
Change NSKeyedUnarchiver method instead of adding overloads
2017-06-22 15:54:49 -07:00
Itai Ferber
184efb085c Allow classes to share an Encoder with superclass
On encode, we previously treated every container request as a push;
instead, we should allow the same container type to be requested
multiple times so a class can pass its Encoder directly to its
superclass if it needs to.
2017-06-22 15:45:02 -07:00
Itai Ferber
a5df6fa484 Change modified method instead of adding overloads
The unarchiveTopLevelObjectWithData which returns Any? (instead of
AnyObject?) was added in Swift 4 and has only shipped in the betas so
far. Instead of adding new overloads which take different types, we
should just fix this one and call it a day.
2017-06-22 14:23:21 -07:00
Philippe Hausler
d31ffc7d5e [Foundation] Validate indexes and ranges passed into Data so that bounding conditions are respected 2017-06-22 11:25:57 -07:00
Itai Ferber
004a98b76f Merge pull request #10474 from itaiferber/nskeyedarchiver-data-overloads
NSKeyedUnarchiver methods should take Data (instead of just NSData)
2017-06-22 10:44:54 -07:00
swift-ci
638cded005 Merge pull request #10481 from xwu/patch-1 2017-06-22 09:57:57 -07:00
Itai Ferber
3266477f6e Merge pull request #10470 from itaiferber/codable-improved-runtime-diagnostics
Improve runtime errors for conditionally-Codable types
2017-06-22 09:20:53 -07:00
Philippe Hausler
6d7c49ff61 [Foundation] Prevent incorrect slice access when dropping elements 2017-06-22 07:23:46 -07:00
Károly Lőrentey
5256d774ea [stdlib] Fix docs on Sequence.Iterator, .Element 2017-06-22 11:40:55 +02:00
John McCall
842558058a Merge pull request #10452 from rjmccall/linked-lists-are-really-hard-okay
Fix a linked-list bug with the exclusivity runtime when accesses are not strictly nested
2017-06-22 00:10:26 -04:00
Xiaodi Wu
f8688d2f97 Update DoubleWidth.swift.gyb 2017-06-21 20:03:48 -05:00
Xiaodi Wu
3916380e7c Prefix countRepresentedWords with underscore [NFC]
Per comments, `countRepresentedWords` is slated for eventual removal along with `_words(at:)`; it's not a part of SE-0104, so let's show users that it's not intended for public consumption.
2017-06-21 20:01:14 -05:00
Kuba (Brecka) Mracek
dc3e6c1116 Prevent _swift_runtime_on_report from having its arguments optimized out. Turns out an empty "asm volatile" isn't enough and we need to explicitly ask that the arguments are also not optimized out. (#10456) 2017-06-21 16:54:54 -07:00
Itai Ferber
cc313da8ab NSKeyedUnarchiver methods should take Data
We missed a few NSKeyedUnarchiver methods during our original renaming
for Swift — some of these methods still take NSData when they can take
Data. We can add Data variants which bridge to NSData to fix this in a
backwards-compatible way.
2017-06-21 16:23:29 -07:00
John McCall
4399bd37fa Fix some embarrassing list-management bugs with the exclusivity runtime
which can arise when accesses are not strictly nested.
2017-06-21 19:04:46 -04:00
Itai Ferber
41f93ca9d3 Improve runtime errors for conditional types 2017-06-21 15:52:31 -07:00
Max Moiseev
42e8491080 [stdlib] Default implementation for BinaryInteger._word(at:)
Temporarily addresses https://bugs.swift.org/browse/SR-5275
2017-06-21 13:46:16 -07:00