Commit Graph

8447 Commits

Author SHA1 Message Date
Nate Cook
9a6fb39701 Merge pull request #11233 from natecook1000/nc-appendkeypath
[stdlib] Mark _AppendKeyPath as visible in interface
2017-07-27 22:49:55 -05:00
Michael Ilseman
befe6933a9 Merge pull request #11212 from milseman/massive_subview_controller
[stdlib] Give Substring its own views
2017-07-27 20:36:52 -07:00
Maxim Moiseev
47e78c071a Merge pull request #11044 from apple/rationalize-bitshifting
[stdlib] Rationalize bitshifting in protocols
2017-07-27 14:50:14 -07:00
Nate Cook
4c646d0da0 [stdlib] Mark _AppendKeyPath as visible in interface 2017-07-27 16:41:42 -05:00
Maxim Moiseev
2ba6cc9bd6 Merge pull request #11157 from airspeedswift/stringprotocolify
[stdlib] Switch Int/Float inits + join to be on StringProtocol
2017-07-27 14:22:25 -07:00
Maxim Moiseev
ec3b7d5b59 Merge pull request #11175 from moiseev/missing-default-profile
[overlay] Add back INSetProfileInCarIntent.defaultProfile for compatibliity
2017-07-26 16:54:25 -07:00
Dave Abrahams
3c6f0c3c67 [stdlib] Repair Substring -> String conversion 2017-07-26 16:02:18 -07:00
Dave Abrahams
41c53ae729 [stdlib] Give Substring its own views
This necessary for ensuring the property that String doesn't keep
inaccessible memory alive.  For example, before this change,

    String(s.dropFirst().unicodeScalars)

would compile and produce a String that owned inaccessible memory.
Now it no longer compiles.

String's view's SubSequences are the same as the Substring's
view. E.g. String.UnicodeScalarView.SubSequence is
Substring.UnicodeScalarView.

New compatibility inits added, to work around the fact that many
previously failable initializers are now non-failable.
2017-07-26 15:59:51 -07:00
Michael Ilseman
442029607b [stdlib] Add in sanity checks for out-of-bounds legacyOffsets.
UTF8View's endIndex needs to potentially apply a legacyOffset. This
adds a sanity check that it is in range, and a fast-path for the
common case of 0.
2017-07-26 15:58:04 -07:00
Michael Ilseman
6cb48529a9 [stdlib] Refactor out StdlibUnittest SPI from the stdlib.
Move _lines and _split out of the standard library and into
StdlibUnittest, which is why they were there in the first place. NFC.
2017-07-26 15:58:04 -07:00
Michael Ilseman
2f0dafbac3 Merge pull request #11191 from milseman/very_persistent
[stdlib] Fix bug in Substring's _persistentContent
2017-07-26 08:57:53 -07:00
Rintaro Ishizaki
c36cb57054 [stdlib] Fix warnings in non-ObjC platforms. (#11200) 2017-07-26 22:42:55 +09:00
Omar Sharif Fathi
888fe8df3d Update String.swift 2017-07-26 02:40:45 +02:00
Max Moiseev
7569dc9585 "[overlay] Add back INSetProfileInCarIntent.defaultProfile for compatibliity
<rdar://problem/33457609>
2017-07-25 15:19:43 -07:00
Michael Ilseman
10e9e336fe [stdlib] Fix bug in Substring's _persistentContent
Substring's _persistentContent has a fast path that avoids a copy when
the Substring represents the entire outer String. It correctly
detected situations where the wrapped _StringCore was not itself a
slice, but was omitting the extra checks to make sure the Substring's
own range covered the entire String.

Test added.
2017-07-25 14:28:57 -07:00
swift-ci
5684766a83 Merge pull request #11167 from DougGregor/nscolor-literal-extended-srgb 2017-07-25 09:19:32 -07:00
Ben Cohen
92bc5b7829 Switch Int/Float inits + join to be on StringProtocol 2017-07-25 08:28:22 -07:00
Doug Gregor
8b3889a0a3 [AppKit overlay] Use NSColor(red:green:blue:alpha:) for color literals.
This initializer, which is the same on iOS, allows negative values and
values > 1.0 to support the extended sRGB color space.

Fixes rdar://problem/33500905.
2017-07-25 07:58:20 -07:00
Itai Ferber
c962bdb56c Merge pull request #11148 from itaiferber/indexset-rangeview-fixes
Fix IndexSet.RangeView indexing with subranges
2017-07-24 19:32:50 -07:00
Michael Ilseman
b37417bdb5 [String] Delete dead code; NFC 2017-07-24 16:09:54 -07:00
Itai Ferber
cb6b3123bf Merge pull request #11138 from itaiferber/nsnumber-custom-anyhashable-fix
NSNumber custom AnyHashable fix
2017-07-24 16:03:26 -07:00
Itai Ferber
b05866a92f Fix IndexSet.RangeView indexing with subranges
On initialization, IndexSet.RangeView made the erroneous assumption that given an intersection range, a nil _indexOfRange(containing: bound) indicated that the bound was beyond the beginning or end of the index set. Instead, the index could simply not exist.

We now calculate the actual intersection of the parent index set with the given intersection range and use that as the index set to view.

This also makes the unit tests for testing range views more comprehensive.
2017-07-24 15:32:03 -07:00
Ben Cohen
ddea636951 [stdlib] Have Substring.filter return a String (#10871)
* Have Substring.filter return a String

* fix spacing nits

new machine so editor misconfigured excuses excuses

* fix spacing nits
2017-07-24 15:23:30 -07:00
Itai Ferber
5252f3b2f8 Fix NSNumber's custom AnyHashable representation
When we give NSNumber a custom AnyHashable representation, we want to
give it as large a box as possible. When we want to compare it against
other AnyHashable boxes such as Int or UInt, it's always possible to
upcast the Int/UInt to a larger integer size like Int64 or UInt64 for
the comparison. By eliminating the smaller boxes we create, we can
maintain the existing behavior that _SwiftTypePreservingNSNumber gave
us.
2017-07-24 12:22:45 -07:00
swift-ci
4d5dfdd42c Merge pull request #10966 from rintaro/stdlib-hashedcollection-switchcase 2017-07-24 00:51:08 -07:00
Dave Abrahams
31341e6753 Merge pull request #10976 from d-ronnqvist/reduce-with-inout
[stdlib] Implement SE-0171: Reduce with inout
2017-07-23 19:57:25 -07:00
Yuka Ezura
73ba66abe1 fix expression CountablePartialRangeFrom
This PR is fix expression `CountablePartialRangeFrom` in Range.swift.gyb.
We can not treat `5.0...` as `CountablePartialRangeFrom`...?
(`CountablePartialRangeFrom`'s `Bound` is `Strideable`)
2017-07-23 15:53:17 +09:00
Michael Gottesman
48f26be865 Merge pull request #11102 from gottesmm/disable_some_tests_for_rea
Disable some tests this time for real.
2017-07-21 14:09:21 -07:00
Michael Gottesman
ec5a92fd04 Disable some tests this time for real. 2017-07-21 13:14:18 -07:00
Itai Ferber
580332b062 Rename encodeWeak to encodeConditional
As part of updates to the Codable API, we are renaming encodeWeak to encodeConditional for clarity.
2017-07-21 10:55:05 -07:00
swift-ci
92898618cb Merge pull request #10982 from apple/stdlib-swift4-modernization 2017-07-20 18:56:23 -07:00
Dave Abrahams
1f6867892a [stdlib] Correct a comment 2017-07-20 18:11:57 -07:00
Dave Abrahams
e8ba44a8d5 Merge pull request #11027 from apple/backward-compatible-utf8-view-slicing
Backward compatible utf8 view slicing
2017-07-20 18:05:27 -07:00
Itai Ferber
409473781d Merge pull request #10350 from inamiy/CodingKey-CustomStringConvertible
Let CodingKey inherit CustomStringConvertible for better debugging
2017-07-20 15:19:57 -07:00
Dave Abrahams
05ff40d125 [stdlib] Backward-compatible String.UTF8View slicing
When slicing String.UTF8View in Swift 3 mode, in the absence of type
context, produce String.UTF8View.
2017-07-20 14:54:16 -07:00
Michael Gottesman
1991d0e7d5 Merge pull request #11060 from gottesmm/disable_tests
Disable some failing tests while I look into a solution.
2017-07-19 23:57:39 -07:00
Itai Ferber
f6e48dceb6 Merge pull request #11025 from michael-lehew/codable_support_for_nsarchival
NSKeyed{Una,A}rchiver should support Codable
2017-07-19 19:11:57 -07:00
Michael LeHew
ef35a001e6 NSKeyed{Una,A}rchiver should support Codable 2017-07-19 16:43:55 -07:00
Michael Gottesman
ab6a4f5249 Disable some failing tests.
rdar://33358110
2017-07-19 16:25:39 -07:00
Saleem Abdulrasool
21a27b05e6 stdlib: tweak printf specifier to be more portable
This just adjusts the printf specifier to use the standard defined
printf conversion specifier rather than assuming that %zd will convert
properly.  NFC.
2017-07-19 10:14:03 -07:00
Dave Abrahams
a86d9ae562 Merge branch 'master' into rationalize-bitshifting 2017-07-18 16:09:05 -07:00
Dave Abrahams
33e9ec4690 [stdlib] Rationalize bitshifting in protocols
Only FixedWidthInteger, not BinaryInteger, should have masking shifts.
BinaryInteger should have a non-masking shift requirement.

Removed some dead code.
2017-07-18 16:00:44 -07:00
Dave Abrahams
879e8e548f Merge pull request #10994 from apple/drop-introduced-annotations
[stdlib] Drop some @available(introduced:...)
2017-07-18 14:30:26 -07:00
Saleem Abdulrasool
40569f01f3 Merge pull request #11039 from compnerd/type-matching
stubs: match return type to header declaration
2017-07-18 14:23:02 -07:00
Huon Wilson
994121e3d2 Merge pull request #10861 from huonw/symbol-list-10
TBD: includes all symbols from a full build and test
2017-07-18 10:54:17 -07:00
Saleem Abdulrasool
8b3bff8277 stubs: match return type to header declaration
Because of differences in the definition of ssize_t, swift uses
`__swift_ssize_t` in the headers.  Make the definition match the
declaration.  NFC.
2017-07-18 10:36:23 -07:00
Dave Abrahams
ff07df8df3 Merge pull request #11006 from apple/bidirectional-utf8-view
[stdlib] Make String.UTF8View bidirectional
2017-07-17 21:40:34 -07:00
Dave Abrahams
e6519fbd2b [stdlib] Make String.UTF8View bidirectional
This is a step along the way toward handling backward-compatiblity of UTF8View
slicing and preventing inadvertent creation of String instances that keep
inaccessible memory alive.
2017-07-17 13:53:45 -07:00
Ben Cohen
4d7ae8ca85 [stdlib] Fix array slice self-assignment bug (#10958)
* Fix bug where assigning from self wasn't checking bounds of the assigned slice matched

* break up if statement
2017-07-17 13:09:35 -07:00
Joe Groff
e2dc62b207 Merge pull request #11004 from jckarter/iuo-key-path
Handle IUO unwraps in key paths.
2017-07-17 12:02:30 -07:00