Commit Graph

572 Commits

Author SHA1 Message Date
Philippe Hausler
bdafb2dac0 Handle no-copy cases and custom deallocators as inline construction of swift Data 2016-12-01 12:27:57 -08:00
Tony Parker
66a1aaa8ed Clarify a few comments on autoupdating vs current for TimeZone, Calendar, and Locale 2016-11-30 08:12:17 -08:00
Philippe Hausler
9c0951b5b2 First draft at a new inlinable version of struct Data 2016-11-29 10:53:44 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Tony Parker
dcb027e683 Remove a "fix-it" overload of URL.resourceValues(forKeys:).
Even though this overload is always unavailable, the compiler was
confusing it with the real one, causing ambiguous error messages.

Fixes SR-3144.
2016-11-17 16:28:52 -08:00
Doug Coleman
692bc1c031 cmake: Allow requiring minimum versions using sdk-os-version triples on
Darwin.

Example:
--darwin-sdk-deployment-targets=fookit-ios-8.0;barkit-tvos-9.2
2016-11-15 16:43:37 -08:00
Tony Parker
8f8f6fd5f3 Fix AffineTransform initializer 2016-11-07 14:02:08 -08:00
Janek Spaderna
d5e1819416 [stdlib] Don't try to construct invalid UnicodeScalars
When inserting a closed range/creating a CharacterSet from a closed
range we must not try to convert this range to a half open one by
incrementing the upperBound UnicodeScalar because not all integer values
are valid values for UnicodeScalar

Fixes SR-2988
2016-11-02 12:20:31 +01:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Kevin Perry
6f83a82d14 Ensure directory URL enumerator error handler block is invoked with non-nil URL 2016-10-26 16:18:51 -07:00
Kevin Perry
66ae38c5e0 1. Use correct URLs in thunk
2. Pass NSString? to thunk, not String?
3. Use proper Objective-C out parameter coding practices
4. Use correct nullability decorator in thunk for backupItemName parameter

rdar://problem/28755011
2016-10-18 16:40:46 -07:00
Slava Pestov
2b1bfe3270 Foundation overlay: Don't rely on URL struct being a single reference
If the struct is resilient, it is passed indirectly. Even if we decide to
make it fixed layout, it's best to remove as many implicit ABI assumptions
as possible from @_silgen_name function calls.

Fixes <rdar://problem/28673618>.
2016-10-17 18:10:37 -07:00
swift-ci
781ee82cf6 Merge pull request #5085 from phausler/Foundation_cleanup 2016-10-17 11:45:36 -07:00
swift-ci
4532e20021 Merge pull request #5125 from parkera/parkera/url_quarantine_fix 2016-10-13 12:29:14 -07:00
Xiaodi Wu
7041b4b2bf [SR-2503] Implement subtraction for CharacterSet (#5201)
* Implement CharacterSet.subtracting(_:)

* Add test for CharacterSet.subtract(_:)

* Expand on test for CharacterSet.subtract(_:)

* Address reviewer comment (CharacterSet tests)

* Improve documentation for CharacterSet set algebra
2016-10-11 15:26:56 -07:00
Tony Parker
15d5875bf3 Fix quarantineProperty in URLResourceValues
NSURL has an odd behavior around the quarantine dictionary URL resource
value - if you want to clear it, you should pass NSNull instead of the
NSDictionary. We need to accomodate that in the overlay code with a
special case.

<rdar://problem/28575806> Cannot remove Quarantine attribute in Swift 3
2016-10-04 15:58:57 -07:00
Tony Parker
1a08dc87a3 Fix a few documentation errors in struct Locale 2016-10-03 15:51:44 -07:00
Philippe Hausler
2ffc3d52f2 [Foundation] Extract NSURL extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
b9da412ddd [Foundation] Extract NSDate extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
da84c29707 [Foundation] Extract NSCoder/NSKeyed(Un)Archiver extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
d1ebf836c9 [Foundation] Extract NSUndoManager extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
1050bc4f1d [Foundation] Extract NSExpression extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
16dce5a76f [Foundation] Extract NSPredicate extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
ae45b2daac [Foundation] Extract NSError extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
c3f87ce097 [Foundation] Extract geometry extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
8017c7abc0 [Foundation] Extract NSRange extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
91f3bb4f55 [Foundation] Extract NSIndexSet extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
cb5b894ac0 [Foundation] Extract NSEnumerator/NSFastEnumeration extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
3522fa8f6e [Foundation] Extract NSSet extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
574f1d068c [Foundation] Extract NSTextCheckingResult extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
c3bcd0dc18 [Foundation] Extract NSDictionary extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
5d28920d8e [Foundation] Extract NSArray extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
4ce31cc7c0 [Foundation] Extract NSNumber extensions into a seperate file
Non functional change; purely organization/gardening (this also extracts the gyb requirement from Foundation.swift)
2016-10-03 12:37:25 -07:00
Philippe Hausler
a1fd6ee38b [Foundation] Extract String extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
7dc60d535a [Foundation] Extract NSString extensions into a seperate file
Non functional change; purely organization/gardening
2016-10-03 12:37:25 -07:00
Philippe Hausler
4e843ff20c [Foundation] Sort the cmake build list for the Foundation overlay 2016-10-03 12:37:25 -07:00
Maxim Moiseev
783b1de217 [Foundation] Extracting the ReferenceConvertible conformance for CharacterSet (#5054) 2016-09-29 11:15:08 -07:00
Doug Coleman
2747d1eed8 Overlays: Fix tool not to find os as a dependency unless it depends on
os/activity.h or os/log.h. Update cmake files again, hardcoding a Darwin
dependency. The script does not notice that Foundation depends on
CoreGraphics, so add that manually.

Also found that MapKit is supported on WATCHOS but we didn't have dependencies
for that.

Favor one line per supported SDK instead of catch-all dependency lines.

Distinguish from SDKs which have no dependencies vs SDKs which are
unsupported on a particular platform by printing `unsupported` to the
console and remove the line in the cmake file because it should
not exist anyway.

This full cleanup was not done before because of circularity detected by the
util, which has since been fixed.

Support directories with spaces.
2016-09-28 10:28:02 -07:00
Doug Coleman
6c6f30b6af Overlays: The dependencies right now are approximate, and when new overlays are
added the build breaks. There's already a tool to get proper
dependencies, `utils/find-overlay-dependencies.sh`, so this patch
allows that tool to update the `CMakeLists.txt` files in-place.

Also it adds a line to the `CMakeLists.txt` files for each SDK so that the tool works.
2016-09-26 12:23:47 -07:00
swift-ci
69925cd54c Merge pull request #5010 from practicalswift/redundant-nil-init 2016-09-25 10:42:55 -07:00
practicalswift
a75ce9b45f [gardening] Remove redundant nil-initialization of optional variables 2016-09-25 18:53:13 +02:00
practicalswift
69b0f622f3 [gardening] Fix inconsistent headers 2016-09-25 18:00:39 +02:00
Joe Groff
9b1f238e5b SE-0139: Bridge all standard number types to NSNumber.
Extend NSNumber bridging to cover not only `Int`, `UInt`, `Double`, and `Bool`, but all of the standard types as well. Extend the `TypePreservingNSNumber` subclass to accommodate all of these types, so that we preserve type identity for `AnyHashable` and dynamic casting of Swift-bridged NSNumbers. If a pure Cocoa NSNumber is cast, just trust that the user knows what they're doing.

This XFAILs a couple of serialization tests that attempt to build the Foundation overlay, but which don't properly handle `gyb` files.
2016-09-23 10:34:22 -07:00
Joe Groff
b0e3c0be59 Merge pull request #4865 from jckarter/nsvalue-bridging
SE-0139: NSValue bridging
2016-09-22 09:13:47 -07:00
Joe Groff
86fbeee285 SE-0139: Bridge Cocoa framework structs to NSValue.
For every struct type for which the frameworks provides an NSValue category for boxing and unboxing values of that type, provide an _ObjectiveCBridgeable conformance in the Swift overlay that bridges that struct to NSValue, allowing the structs to be used naturally with id-as-Any APIs and Cocoa container classes. This is mostly a matter of gyb-ing out boilerplate using `NSValue.init(bytes:objCType:)` to construct the instance, `NSValue.objCType` to check its type when casting, and `NSValue.getValue(_:)` to extract the unboxed value, though there are a number of special snowflake cases that need special accommodation:

- To maintain proper layering, CoreGraphics structs need to be bridged in the Foundation overlay.
- AVFoundation provides the NSValue boxing categories for structs owned by CoreMedia, but it does so using its own internal subclasses of NSValue, and these subclasses do not interop properly with the standard `NSValue` subclasses instantiated by Foundation. To do the right thing, we therefore have to let AVFoundation provide the bridging implementation for the CoreMedia types, and we have to use its category methods to do so.
- SceneKit provides NSValue categories to box and unbox SCNVector3, SCNVector4, and SCNMatrix4; however, the methods it provides do so in an unusual way. SCNVector3 and SCNVector4 are packaged into `CGRect`s and then the CGRect is boxed using `valueWithCGRect:`. SCNMatrix4 is copied into a CATransform3D, which is then boxed using `valueWithCATransform3D:` from CoreAnimation. To be consistent with what SceneKit does, use its category methods for these types as well, and when casting, check the type against the type encoding SceneKit uses rather than the type encoding of the expected type.
2016-09-21 19:26:10 -07:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00
practicalswift
2ee3c45b5b Merge pull request #4852 from practicalswift/optionals-set-to-nil
[gardening] Remove redundant nil-initialization of optional variables
2016-09-19 11:14:31 +02:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00
Dmitri Gribenko
75fb1747d1 Foundation: change Data.Indices to be a CountableRange<Int>, that is much faster than the default 2016-09-18 03:57:07 +03:00
Dmitri Gribenko
573ed96ba2 Set Foundation.Data.SubSequence to be RangeReplaceable
RangeReplaceableCollection.SubSequence should be a
RangeReplaceableCollection.  Data implements RangeReplaceableCollection,
but sets SubSequence to MutableRandomAccessSlice that is not a
RangeReplaceableCollection.

This commit changes Foundation.Data.SubSequence to
MutableRangeReplaceableRandomAccessSlice.

Fixes rdar://problem/28330713.
2016-09-18 03:57:07 +03:00