Commit Graph

3245 Commits

Author SHA1 Message Date
wmattelaer
a724284455 [overlay] Introducing INParameter
<rdar://problem/32409847>
2017-06-26 11:21:10 -07:00
Joe Groff
3c82e981f9 KeyPaths: Add support for optional chaining/forcing components.
rdar://problem/31768715
2017-06-26 09:40:31 -07: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
swift-ci
8131aca7a1 Merge pull request #10546 from moiseev/flatmap-test-version 2017-06-23 15:36:32 -07:00
Max Moiseev
e77fd218dd [test] Report Swift version in the test name 2017-06-23 14:54:17 -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
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
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
Philippe Hausler
6d7c49ff61 [Foundation] Prevent incorrect slice access when dropping elements 2017-06-22 07:23:46 -07:00
Philippe Hausler
3fc134f8bb [Foundation Tests] Add a unit test to validate the behavior of dropFirst 2017-06-21 11:17:39 -07:00
Jordan Rose
e9622db324 [Foundation] Make CocoaError.Code and URLError.Code Hashable. (#10437)
This is consistent with imported error codes, which are always
Hashable. URLError.Code was also Hashable in Swift 3.1 by virtue of
being defined as an enum; the change to a struct broke that.

rdar://problem/32066434
2017-06-20 20:15:48 -07:00
Joe Groff
860e3a4ca4 Merge pull request #10419 from jckarter/key-path-alignment
KeyPaths: Pointer-align pointer fields within key path patterns.
2017-06-20 19:44:10 -04:00
Joe Groff
752beac4f1 KeyPaths: Pointer-align pointer fields within key path patterns.
To get the full benefit of dyld3 on Darwin platforms, pointer relocations need to be pointer-aligned, which unfortunately requires growing some key path data structures a little bit. This does tidy up some code that had to hack around our lack of unaligned load/store operations on UnsafeRawPointer, at least. While we're here, we can also simplify the identification strategy for reabstracted stored properties; we only need the property index to identify, not the absolute offset. rdar://problem/32318829
2017-06-20 14:42:05 -07:00
Itai Ferber
e0f75bf841 Merge pull request #10343 from itaiferber/cg-types-codable-conformance
Add Codable conformance to common CG types
2017-06-20 09:32:56 -07:00
Itai Ferber
fedf8e6908 Add Codable conformance to common CG types
Give custom Codable implementations for CGAffineTransform, CGPoint,
CGSize, CGRect, and CGVector, along with unit tests.
2017-06-19 17:23:11 -07:00
Philippe Hausler
29f080f0c3 [Foundation] 1-ary IndexPath forms invalid range on slices 2017-06-16 17:41:19 -07:00
Joe Groff
cf3da5f3de Merge pull request #10302 from jckarter/keypath-indirect-offset
[SR-5036]: Segfault using KeyPath with NSObject
2017-06-16 19:16:24 -04:00
Philippe Hausler
c358afe655 [Foundation] Adjust Double and Float bridges to be more lenient 2017-06-16 15:18:27 -07:00
Joe Groff
fe88bd5f3f KeyPaths: Correctly instantiate offsets for final stored properties in NSObject subclasses.
We need to use the ivar offset variables in this case, since the Swift field offset vector doesn't pick up the adjusted offsets from the ObjC runtime. Fixes SR-5036 | rdar://problem/32488871.
2017-06-16 14:42:32 -07:00
Philippe Hausler
1ca142eba4 [Foundation] Correct NSRange equality typo and add unit tests for newly added NSRange behaviors (#10282) 2017-06-16 13:38:31 -07:00
Mishal Shah
c5ff1f2cac Update master to build with Xcode 9 beta 1, OS X 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-06-14 16:20:35 -07:00
Itai Ferber
5daa71c8ad Merge pull request #10249 from itaiferber/master
Allow SingleValueContainers to decode collections
2017-06-14 14:24:15 -07:00
Maxim Moiseev
651aaa8b54 Merge pull request #10206 from moiseev/unambiguous-bitpattern
[stdlib] Resolve the ambiguity for Int32.init(bitPattern:)
2017-06-14 11:34:32 -07:00
Itai Ferber
48d183e62a Allow SingleValueContainers to decode collections
SingleValueDecondingContainers in JSON and Plist previously held the
assertion that attempting to decode an array or dictionary from them
was a type mismatch (since those represented unkeyed and keyed
containers, respectively). This assertion is no longer true, though,
since encode<T : Encodable>(_:) and decode<T : Decodable>(_:) allow
you to do just that.

This lifts the assertion and adds unit tests to both implementations to
ensure this works. (Addresses https://bugs.swift.org/browse/SR-5089)
2017-06-14 11:14:20 -07:00
Graydon Hoare
b12722844a [varargs] Add test for rdar://32547102 2017-06-13 20:07:20 -07:00
Max Moiseev
90a20ea015 [stdlib] Resolve the ambiguity for Int32.init(bitPattern:)
When this initializer is invoked with an integer literal, the expression
is ambiguous, since both UIn32 and Float are
RepresentableByIntegerLiteral.

Fixes: https://bugs.swift.org/browse/SR-5176
2017-06-13 17:28:19 -07:00
Arjun Nayini
a3e94cc1d1 Merge branch 'master' into bugfix/SR-4172 2017-06-07 09:37:45 -07:00
Maxim Moiseev
0c108340d1 Merge pull request #9367 from natecook1000/nc-doublewidth
[stdlib] DoubleWidth Implementation
2017-06-05 10:03:42 -07:00
Robert Widmann
71bf312a25 Migrate the rest of the tests to %empty-directory 2017-06-04 11:08:39 -07:00
Robert Widmann
6509f78f13 tests: replace remaining 'mkdir -p' calls with %empty-directory(...)'
These changes were made manually.
2017-06-04 11:08:39 -07:00
Dmitri Gribenko
984210aa53 tests: replace '// RUN: rm -rf' '// RUN: mkdir' pairs with '%empty-directory(...)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Ben Cohen
d0c0043f93 [stdlib] Use ephemeral string for substring comparison (#10009)
* Use _ephemeralString for substring comparison

Add back != for String/Substring comparison

* OK fine, Linux, if you're going to be difficult

* Different forms of comparison, tests
2017-06-03 11:20:01 -07:00
Dave Abrahams
3a7a30a822 Merge pull request #10059 from apple/utf16-small-character
[stdlib] Encode small Characters as UTF-16
2017-06-02 11:49:40 -07:00
Dave Abrahams
51bf3a615f [stdlib] Make single-grapheme check debug-only
Because of the way grapheme breaking changes across updates to ICU and the Unicode standard, it may not even be legit to check this at all.  It's certainly not unsafe to skip the check, so let's see if we can do that in release builds, as grapheme breaking is expensive.
2017-06-02 09:53:22 -07:00
Dave Abrahams
562fd79aa6 [stdlib] Encode small Characters as UTF-16
This takes care of the standard library portion, but we need a new
BuiltinUTF16ExtendedGraphemeClusterLiteralConvertible protocol in order to
fully recover the performance of character literals.

Note that part of the character_literals.swift test is currently disabled.  That
will need to be fixed before we can merge this work.
2017-06-01 20:57:25 -07:00
Ben Langmuir
354dddd7e0 Disable TestData with reslience temporarily
This test is broken on our resilience bot; disable it until it is fixed.

rdar://problem/32472729
2017-06-01 09:32:33 -07:00
swift-ci
3ba644c782 Merge pull request #10020 from dabrahams/nix-_HeapBuffer2 2017-06-01 06:17:44 -07:00
Dave Abrahams
b2e4bd5d09 [stdlib] Replace _HeapBuffer with a thin wrapper
...over ManagedBufferPointer
2017-06-01 04:40:52 -07:00
Joe Groff
ad700c5d6b Merge pull request #10014 from jckarter/existential-keypath-base
SILGen: Handle existential keypath root types.
2017-05-31 16:59:09 -07:00
Joe Groff
4fc0b7df96 SILGen: Handle existential keypath root types.
SR-4917|rdar://problem/32254554
2017-05-31 16:01:02 -07:00
Max Moiseev
53004a1015 [stdlib] Renames and tests for Swift 3 compatibility mode
Addresses <rdar://problem/32432481>
2017-05-26 16:28:11 -07:00
Joe Groff
8022266404 Merge pull request #9933 from jckarter/partial-key-path-application
Support application of AnyKeyPath/PartialKeyPath.
2017-05-26 08:45:55 -07:00
Nate Cook
1149eeac16 Incorporate feedback from @moiseev
- Also clean up some 80-column issues
- And improve some tests from before literal expressibility
2017-05-25 18:32:15 -05:00
Joe Groff
cdc7a5c945 Support application of AnyKeyPath/PartialKeyPath.
rdar://problem/32237567
2017-05-25 15:51:22 -07:00
Nate Cook
5ab34bf6f0 Add floating-point initializers and tests 2017-05-24 19:16:26 -05:00
Nate Cook
40f6869b80 More tests for DoubleWidth 2017-05-24 19:16:26 -05:00
Nate Cook
4a24a968ca Slightly better DoubleWidth testing 2017-05-24 19:16:26 -05:00
Nate Cook
c8f4c4bb8e A few tests for DoubleWidth 2017-05-24 19:16:26 -05:00