Commit Graph

442 Commits

Author SHA1 Message Date
David Farler
f924e8e007 ArraySlice indexes no longer zero-based
ArraySlice indices now map directly onto the collection it is slicing
and maintains that mapping even after mutations.

Before:

var a = Array(0..<10)
var s = a[5..<10]
s.indices        // 0..<5
s[0] = 111
s                // [111, 6, 7, 8, 9]
s.removeFirst()
s.indices        // 1..<5

After:

var a = Array(0..<10)
var s = a[5..<10]
s.indices        // 5..<10
s[5] = 99
s                // [99, 6, 7, 8, 9]
s.removeFirst()
s.indices        // 6..<10

- Refactor some of the internals of the buffer types to make it easier
  to read and understand.
- Add Array, ArraySlice, and ContiguousArray to the test suite at the
  RangeReplaceable test entry points, subjecting them to the same tests
  as all of our collections.
- Update existing test expectations for the indexing changes.

rdar://problem/21866825

Swift SVN r30840
2015-07-31 03:25:29 +00:00
Zoltan Foley-Fisher
4f87b6e8c5 Fix <rdar://problem/18063644> [SWIFT] XCTAssert(Non)Nil should work on any optional type
Swift SVN r30813
2015-07-30 20:40:10 +00:00
Dmitri Hrybenko
c712ce3b5e simd overlay: drop label from second parameter in distance, distance_squared
Patch by Steve Canon.

Swift SVN r30695
2015-07-27 19:56:34 +00:00
Jordan Rose
a42ff82c80 Handle optional return for UIGraphicsGetImageFromCurrentImageContext too.
rdar://problem/21990808

Swift SVN r30615
2015-07-25 01:39:46 +00:00
Dmitri Hrybenko
f5de8757e4 stdlib: remove Word and UWord
These types are leftovers from the early pre-1.0 times when Int and UInt
were always 64-bit on all platforms.  They serve no useful purpose
today.  Int and UInt are defined to be word-sized and should be used
instead.

rdar://18693488

Swift SVN r30564
2015-07-24 05:01:32 +00:00
Dmitri Hrybenko
f44901dac6 CoreMedia overlay: change camel-casing of preferredTimeScale
Swift SVN r30538
2015-07-23 15:33:53 +00:00
Zoltan Foley-Fisher
4a3b5bada3 <rdar://problem/17541074> [SWIFT] Should XCTAssertEqual and friends take optional/nullable types?
Now comparing optionals in XCTAssertEqual/XCTAssertNotEqual

Swift SVN r30516
2015-07-22 23:42:37 +00:00
David Farler
1f2390f1c7 Drop APIs from NSPathUtilities.h on String
rdar://problem/18848175

Swift SVN r30507
2015-07-22 22:12:56 +00:00
Jordan Rose
5b16185eb6 Fix -Wnullability-declspec issues in GameplayKit overlay.
No functionality change.

Swift SVN r30480
2015-07-22 00:14:04 +00:00
Dmitri Hrybenko
740d0c871e CMake: simplify PassKit dependencies
Swift SVN r30404
2015-07-20 17:16:41 +00:00
Dmitri Hrybenko
a7190bf16e Build the Contacts overlay for watchOS
Thanks Jordan!

Swift SVN r30400
2015-07-20 16:13:37 +00:00
David Farler
da670c5a34 libswiftWatchKit depends on libswiftCoreLocation
<rdar://problem/21885844>

Swift SVN r30373
2015-07-18 06:55:13 +00:00
Dmitri Hrybenko
0fd6fd1f8f CoreMedia overlay: add an initializer CMTimeRange(start🔚)
rdar://20939243

Patch by Adam Sonnanstine + tests from me.

Swift SVN r30364
2015-07-18 03:35:08 +00:00
Dmitri Hrybenko
1e7e471dd9 CMake: record that PassKit overlay depends on the new Concacts overlay
Swift SVN r30363
2015-07-18 03:27:37 +00:00
Dmitri Hrybenko
48c901c918 Foundation overlay: use the new selectors for NSCoder APIs
rdar://21431062

Swift SVN r30362
2015-07-18 03:08:17 +00:00
Joe Groff
d6f1178568 Foundation overlay: Deprecate String "PercentEscapesUsingEncoding" methods.
These have been superseded by newer APIs in Foundation, and Swift should follow suit. rdar://problem/21397308

Swift SVN r30356
2015-07-18 02:25:51 +00:00
Dmitri Hrybenko
9392d76fd7 Additions to the SceneKit overlay
<rdar://problem/20855539> Add SCNVector3/4 Swift convenience
<rdar://problem/20854576> Add SCNFloat to the SceneKit swift overlay

Patch by Amaury Balliet.

Swift SVN r30353
2015-07-18 01:08:05 +00:00
Dmitri Hrybenko
3ba51ad202 Foundation overlay: fix coding style
Swift SVN r30350
2015-07-18 00:39:46 +00:00
Dmitri Hrybenko
6cef57029f Remove the SDK overlay for Security
It is no longer needed per rdar://19785756

Swift SVN r30349
2015-07-18 00:39:43 +00:00
Dmitri Hrybenko
6ba6de23aa Revert "Eliminate the NSError -> error enum bridging from Contacts."
This reverts commits r29003 and r29005.

The blocking issue, rdar://21032649, is fixed.

rdar://21032711

Swift SVN r30345
2015-07-17 23:59:49 +00:00
Doug Gregor
89ff140503 Move the default implementation of ErrorType._domain into the standard library.
There is no reason for the compiler to be synthesizing a body of
_domain when it can be implemented in a protocol extension. As part of
this, fix a recent regression in the computed domain: it was using
string interpolation, which means that the recent changes not to print
qualified names affected the domain of the generated NSErrors. Oops.

Swift SVN r30343
2015-07-17 23:37:59 +00:00
Dmitri Hrybenko
82ec7ea9d2 CoreMedia overlay: make CMTime Comparable, and CMTimeRange Equatable
Change approved by Adam Sonnanstine.

Swift SVN r30335
2015-07-17 22:26:58 +00:00
Jordan Rose
965285f13d Move GameKit overlay to GameCenter.
In iOS 9 and OS X 10.11 the old GameKit was effectively renamed GameCenter, while
the new GameKit is a sort of umbrella framework like Cocoa. We need to support
backwards deployment, though, so the GameCenter overlay links to GameKit.framework.
(This is essentially the same solution implemented for CoreImage moving out of
QuartzCore in r28449)

rdar://problem/21340738

Swift SVN r30322
2015-07-17 19:54:38 +00:00
Dmitri Hrybenko
109add8131 Foundation overlay: add NSCoder.decodeObjectOfClasses(_:forKey:)
Due to the fact that AnyClass is not Hashable, and that currently
NSKeyedArchiver/Unarchiver work with NSObject-derived, NSCoding
compliant classes, we are marking the decodeObjectOfClasses API refined
for Swift in our objc header and providing the desired overlay in our
overlay as shown below.

Arrays were also considered (for both API), but the underlying
implementation is entirely set-based, and using Arrays in Swift vs Sets
in objective C felt like too far a deviation.

Patch by Michael LeHew Jr.

Changes to the Dictionary test are caused by bumping the Fonudation API
epoch and taking in a fix in the types used in an NSDictionary
initializer.

rdar://21486551

Swift SVN r30297
2015-07-17 03:07:47 +00:00
Dmitri Hrybenko
71c5bb9371 CoreMedia overlay: change CMTimeMakeWithSeconds into an initializer
Patch by Adam Sonnanstine.

rdar://20940262

Swift SVN r30271
2015-07-16 20:24:47 +00:00
Dmitri Hrybenko
82c6b23239 SDK overlay: use AnyObject instead of AnyClass to pass an id-compatible
Class representation

As Joe explained, when Swift passes a metatype like AnyClass for an type
defined in Objective-C, it will pass the Swift metadata pointer instead
of an id-compatible Class.

Swift SVN r30268
2015-07-16 17:34:09 +00:00
Dmitri Hrybenko
9d27519a69 SDK overlay: fix a bug in the SceneKit overlay and re-enable the test
Patch by Amaury Balliet.

Part of rdar://20738811

Swift SVN r30234
2015-07-15 23:29:09 +00:00
David Farler
b9fe9eef63 Explicitly mark GameKit -> simd overlay dependency
Speculative fix for rdar://problem/21808853.

Swift SVN r30232
2015-07-15 22:57:12 +00:00
David Farler
e689ab3369 Mark AppKit -> CoreData dependency in the overlays
AppKit links CoreData and this relationship isn't expressed
in the build mechanics for the overlays, which can cause
link failures when building the overlay.

rdar://problem/21837604

Swift SVN r30223
2015-07-15 18:49:10 +00:00
Jordan Rose
497e990c0b Handle UIGraphicsGetCurrentContext's return value becoming optional.
...in such a way that both older and newer SDKs are supported (at least for now).

rdar://problem/21819293

Swift SVN r30193
2015-07-14 20:31:44 +00:00
Enrico Granata
88e3c41f39 Provide a specific (legacy) Mirror for NSString
This does not cause any functionality change, except it solves the issue I was running into last night where an array of NSString-s would expose its child values as plain Strings



Swift SVN r30092
2015-07-10 21:37:46 +00:00
Ted Kremenek
56a3ddbdb4 Make UIEdgeInsets and UIOffset conform to Equatable.
Implemented at the behest of the UIKit team.

Implements <rdar://problem/18109916>.

Swift SVN r30089
2015-07-10 21:11:25 +00:00
Jordan Rose
cbda31eba4 [stdlib] Underscore the 'value' members of DarwinBoolean and ObjCBool.
Per Dmitri's request and stdlib conventions. Also, remove the reference to
what's now '_value' from the DarwinBoolean tests, and use unsafeBitCast
instead to mimic representation-compatible access from C.

Swift SVN r30066
2015-07-10 06:25:06 +00:00
Jordan Rose
0b5428fcd3 Import DarwinBoolean as Bool in fully-bridgeable contexts.
These are contexts where we have enough information to bridge /back/
properly; that is, where we can distinguish CBool, ObjCBool, and
DarwinBoolean. In cases where we can't, we keep the three separate;
only CBool is really the same type as Bool.

This also affects current import behavior for ObjCBool, which was previously
incorrectly conflated with CBool in certain cases.

More rdar://problem/19013551

Swift SVN r30051
2015-07-10 01:11:30 +00:00
Jordan Rose
e1ffbbbcf5 Import MacTypes.Boolean as a dedicated DarwinBoolean type.
Like ObjCBool is a legitimate boolean type rather than a typealias for Int8,
DarwinBoolean is better than a typealias for UInt8. It's a BooleanType
(meaning you can use it directly in if/while/?:) and BooleanLiteralConvertible
(meaning you can use 'true' and 'false').

The next commit goes even further, so that you only have to deal with
DarwinBoolean when ABI is important. At all other times it should be
bridged with Bool, just like ObjCBool.

rdar://problem/19013551

Swift SVN r30050
2015-07-10 01:11:25 +00:00
Dave Abrahams
913f09838a [stdlib] Add a default generate() for generators...
...that are also sequences, and rip out all redundant implementations of
generate() that match a default.

Swift SVN r30035
2015-07-09 19:49:24 +00:00
Joe Groff
ae7f8bdb65 simd module: Only provide '&+', '&-', and '&*' variants of arithmetic operators.
Checked arithmetic is probably not what you want from the vector unit, but we still want code to be explicit about the fact that it's using wrapping semantics instead of trapping or UB semantics. Provide the wrapping variations of the operators, and leave behind unavailable definitions to direct users to the wrapping operations if they try to use the standard ones.

Swift SVN r30008
2015-07-09 01:20:20 +00:00
Joe Groff
0b54e21629 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Reapplying now that Nadav's fixed the ARM64 SelectionDAG issue this exposed before, and Arnold's fixed
yet another SelectionDAG issue exposed after that.

Swift SVN r30006
2015-07-09 01:20:01 +00:00
Arnold Schwaighofer
8517b7ba08 Revert "Un-XFAIL test on Linux."
Revert "simd overlay: Use LLVM vector types."

This reverts commit r29922 and r29924.

More arm64 instruction selection errors.

rdar://21703486

Swift SVN r29941
2015-07-07 16:45:08 +00:00
Joe Groff
9a23fa9040 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Reapplying now that Nadav's fixed the ARM64 SelectionDAG issue this exposed before.

Swift SVN r29922
2015-07-06 22:56:42 +00:00
Joe Groff
e692c87bbf Revert "simd overlay: Use LLVM vector types."
This reverts commit r29891. It causes an LLVM assertion failure in SelectionDAG on appletvos-arm64.

Swift SVN r29893
2015-07-02 17:31:34 +00:00
Joe Groff
8103dfb825 simd overlay: Use LLVM vector types.
This brings the David Owens benchmark from http://owensd.io/2015/06/27/performance-xcode7-beta-2.html from parity with simd.h-based C to 3x faster.

Before:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 7.035851 │ 6.304739 │ 9.815832 │  1.212 │

After:

RenderGradient ([UInt32].withUnsafeMutablePointer (SIMD))                 │ 2.318357 │ 2.223325 │ 2.697981 │ 0.1490 │

This also addresses rdar://problem/21574425, since Builtin.add_VecNxIntM isn't overflow-checked, and overflow checks really aren't wanted when working with vector types directly.

Swift SVN r29891
2015-07-02 17:05:29 +00:00
Dmitri Hrybenko
4eb24da01b stdlib: underscore MirrorType
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29833
2015-07-01 04:05:48 +00:00
Dmitri Hrybenko
9da16e592e stdlib: underscore reflect() and unsafeReflect()
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29826
2015-07-01 00:31:39 +00:00
Dmitri Hrybenko
8d79d9e142 stdlib: underscore MirrorDisposition
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29825
2015-07-01 00:31:37 +00:00
Dmitri Hrybenko
6bc93d4d79 stdlib: finish renaming QuickLookObject to PlaygroundQuickLook
Part of removing the old mirrors.

rdar://21428474

Swift SVN r29824
2015-07-01 00:31:35 +00:00
Dmitri Hrybenko
7ee84ed6b3 stdlib: rename Reflectable.{getMirror() -> _getMirror()}
Start removing the old mirrors.

rdar://21428474

Swift SVN r29823
2015-07-01 00:31:32 +00:00
Devin Coughlin
cb85eac07e WatchKit Overlay: Remove temporary hack to disable availability checking
Remove a temporary hack added in r29026 that disabled availability checking
for the WatchKit overlay due to SDK update issues. It is no longer needed.

rdar://problem/21099550

Swift SVN r29652
2015-06-25 01:56:58 +00:00
Dmitri Hrybenko
09ab3c17dc stdlib: rename generic parameters from T to Element
... for UnsafeBufferPointerGenerator, UnsafeBufferPointer,
UnsafeMutableBufferPointer.

Part of rdar://21429126

Swift SVN r29623
2015-06-24 20:41:54 +00:00
Dmitri Hrybenko
d9726efbb2 stdlib: rename Set's generic parameter from T to Element
Same for SetGenerator and SetIndex.

Part of rdar://21429126

Swift SVN r29619
2015-06-24 20:41:51 +00:00