Commit Graph

3245 Commits

Author SHA1 Message Date
Joe Pamer
1c53181667 Again, fix two problems with implicit conversions:
- rdar://problem/16776273, wherein conversions between nil and .None were permitted
due to an implicit conversion between nil and COpaquePointer.
- rdar://problem/16877526, where we needed to add new equality overloads to handle
conversions between nil and .None given the supression of user conversions.

(Some minor tweaks this time around for better interoperability with AnyObject.)

Swift SVN r18498
2014-05-21 18:56:35 +00:00
Greg Parker
f24baa1eb7 [test] Create temp directory before using it.
Swift SVN r18497
2014-05-21 18:08:10 +00:00
Dmitri Hrybenko
5855c2b34f stdlib/Printing: remove superfluous newlocale() call
Also add tests for post-processing printed results in scientific notation.


Swift SVN r18495
2014-05-21 14:12:31 +00:00
Dmitri Hrybenko
ea1d75a3dd stdlib/Join: ensure that the test actually fails when one of the checks fails
Swift SVN r18494
2014-05-21 13:31:05 +00:00
Dmitri Hrybenko
9a4004ab61 stdlib/Join: add forwarding join() instance functions to array and string types
rdar://16388632


Swift SVN r18493
2014-05-21 13:15:30 +00:00
Dmitri Hrybenko
3fab925b77 stdlib/BitwiseOperations: add a basic test
Swift SVN r18492
2014-05-21 11:59:01 +00:00
Dmitri Hrybenko
2fc5297171 stdlib/Slice: relax assertion to allow Slice<T> to be constructed from a native
empty buffer without storage

rdar://16971593 rdar://16388632


Swift SVN r18489
2014-05-21 11:01:55 +00:00
Dmitri Hrybenko
4693583767 stdlib/Join: fix an ambiguity in 'ExtensibleCollection + ExtensibleCollection'
Allows to use '+' on arrays.

rdar://16984439 rdar://16388632


Swift SVN r18488
2014-05-21 09:32:51 +00:00
Joe Pamer
1d34a88477 Revert "Fix two problems with implicit conversions: - rdar://problem/16776273, wherein conversions between nil and .None were permitted due to an implicit conversion between nil and COpaquePointer. - rdar://problem/16877526, where we needed to add new equality overloads to handle conversions between nil and .None given the supression of user conversions. (Thanks to Ted for the overloads and test.)"
This reverts commit r18473.

Swift SVN r18477
2014-05-21 00:28:46 +00:00
Joe Pamer
f469d8f1f6 Fix two problems with implicit conversions:
- rdar://problem/16776273, wherein conversions between nil and .None were permitted
due to an implicit conversion between nil and COpaquePointer.
- rdar://problem/16877526, where we needed to add new equality overloads to handle
conversions between nil and .None given the supression of user conversions.
(Thanks to Ted for the overloads and test.)

Swift SVN r18473
2014-05-20 23:53:34 +00:00
Greg Parker
e2ca13c993 <rdar://16529903> Make UIViewController's nib search find Swift class names.
UIViewController is able to find nib files that have names derived from the 
UIViewController subclass's name. This change modifies UIViewController's 
lookup so it is able to find nib files for Swift class names.


Swift SVN r18470
2014-05-20 23:14:52 +00:00
Dmitri Hrybenko
8910632338 stdlib/Dictionary: allow NSDictionary to be bridged to Dictionary<K, V> non-verbatim
Dictionary's isBridgedToObjectiveC() was overly restrictive.  This went
unnoticed because the tests were using internal Dictionary APIs to construct
the desired state, instead of going thourgh casts.

rdar://16973429


Swift SVN r18454
2014-05-20 16:06:52 +00:00
Dmitri Hrybenko
bbf7b0af98 stdlib/Dictionary: add 'removeAll:' API
rdar://16953595

Swift SVN r18453
2014-05-20 14:52:01 +00:00
Dmitri Hrybenko
46790743be stdlib/Join: new: add a generic join() function that behaves like NSArray's
componentsJoinedByString:, or Python's join(), but is generic, operating on any
ExtensibleCollection

Part of rdar://16388632


Swift SVN r18450
2014-05-20 11:56:15 +00:00
Greg Parker
a9ba72db3e [test] Work around incorrect objc ABI selection in simulator tests.
Swift SVN r18449
2014-05-20 07:38:55 +00:00
Doug Gregor
9138ba2763 Add some tests that involve passing bridged arrays between Swift and Objective-C.
Swift SVN r18445
2014-05-20 04:39:37 +00:00
Dmitri Hrybenko
bbc6a92a4c stdlib/Assert: don't print stdlib filename and line number in stdlib traps
rdar://16958193


Swift SVN r18431
2014-05-19 21:37:51 +00:00
Dave Abrahams
418bec853f [stdlib] 1-character fix for Array.reserve
...plus the testing that makes that fix stick.  Fixes <rdar://16958865>

Swift SVN r18429
2014-05-19 21:20:48 +00:00
Dmitri Hrybenko
af11f8f8b7 stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

Fixes == operator.


Swift SVN r18420
2014-05-19 14:48:53 +00:00
Dmitri Hrybenko
ebb11183d5 stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

More tests for generate: API.


Swift SVN r18417
2014-05-19 11:57:16 +00:00
Dmitri Hrybenko
8c13cc3238 stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

More tests for generate: API.


Swift SVN r18416
2014-05-19 11:53:20 +00:00
Dmitri Hrybenko
0d20e71f51 stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

Fixes generate: API and DictionaryGenerator.


Swift SVN r18415
2014-05-19 11:48:44 +00:00
Dmitri Hrybenko
336117ed2f stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

Add tests for count API.


Swift SVN r18414
2014-05-19 11:39:44 +00:00
Dmitri Hrybenko
6d3026266f stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

Fixes removeValueForKey: API.


Swift SVN r18413
2014-05-19 11:33:25 +00:00
Dmitri Hrybenko
72354e8a47 stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

Fixes removeAtIndex: API.


Swift SVN r18411
2014-05-19 11:20:34 +00:00
Dmitri Hrybenko
d2ab47442b stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

Add tests for updateValue:forKey: API.


Swift SVN r18410
2014-05-19 11:12:34 +00:00
Dmitri Hrybenko
c4492b4544 stdlib/Dictionary: continue removing the assumption that keys and values are
bridged back from Objective-C verbatim

Fixes subscript(KeyType) API.


Swift SVN r18409
2014-05-19 10:36:11 +00:00
Dmitri Hrybenko
785aabd53e stdlib/Dictionary: start removing the assumption that keys and values are
bridged back from Objective-C verbatim

Fixes subscript(Index) API.


Swift SVN r18408
2014-05-19 10:03:59 +00:00
Dmitri Hrybenko
37482de929 stdlib/Dictionary test: remove unneeded reinterpretCast
Swift SVN r18400
2014-05-19 08:00:14 +00:00
Doug Gregor
2cea48a91d Unify ArrayDowncastExpr handling with ConditionalCheckedCastExpr handling.
The latter has some brilliant code to deal with differing levels of
optionality, binding inner optionals etc. Unifying these code paths
makes array downcasts work when the source has (possibly
implicitly-wrapped) optional type, e.g.,

var arrImplicitOpt: AnyObject[]! = nsarr
if let strArr = arrImplicitOpt as String[] {
  println("String array contains \(strArr)")
} else {
  println("Not a string array")
}

Another part of <rdar://problem/16952771> and the array-bridging story.


Swift SVN r18392
2014-05-19 05:14:39 +00:00
Dave Abrahams
fba449f83d [stdlib] Add an eager reverse() for Array
Swift SVN r18390
2014-05-19 04:40:39 +00:00
Dave Abrahams
13962588a9 [stdlib] add reverse(c), s/Reverse/ReverseView/g
Now reverse() is available as a peer to map() and filter()
Addresses <rdar://problem/15919204>

Swift SVN r18389
2014-05-19 04:30:16 +00:00
Joe Pamer
e4e472bf09 When emitting diagnostics for failed constraints, favor conformances with fewer unsubstituted type variables. (rdar://problem/16892723)
Swift SVN r18388
2014-05-19 04:29:15 +00:00
Dave Abrahams
5a4891a2db [stdlib] make Array.replaceRange be a method
By beating the compiler into submission with a "bouncing through
non-methods" method, I have made it accept my crazed intention that
Array and friends should interoperate with all Sequences and
Collections!  Filing <rdar://problem/16954833> to document the failure
of the method method.

Swift SVN r18378
2014-05-19 01:08:08 +00:00
Dave Abrahams
6dade3f1c8 [stdlib] Test Array.removeLast
Also improve its failure message

Swift SVN r18376
2014-05-19 00:36:37 +00:00
Doug Gregor
2da304d05e Start using the _arrayBridgeFromObjectiveC entry point for checked downcasts.
This allows us to perform a checked downcast from an Object[] to a String[].

Swift SVN r18371
2014-05-19 00:04:41 +00:00
Dave Abrahams
8537f014bf [stdlib] Add lazy and Array filter algorithm
This came up during API review

Swift SVN r18364
2014-05-18 22:24:43 +00:00
Dave Abrahams
241f4e9b46 [stdlib] Avoid Suicide Sequences
In a naive implementation of a Sequence adapter, adapting a
non-self-destructive (multi-pass) Sequence having a reference-semantics
Generator produces a self-destructive adapted view.  This is technically
correct because Sequences are allowed to be self-destructive, and
theoretically every multi-pass Sequence would be a Collection.  However
Sequences are much easier to build than Collections, so users are likely
to make them, and it would be extremely surprising if adapting a
self-preserving Sequence yielded a self-destructive one.

Swift SVN r18350
2014-05-18 20:38:33 +00:00
Dmitri Hrybenko
a80603f3bb stdlib/Floating point: switch infinity, NaN, quietNaN to properties
Swift SVN r18348
2014-05-18 20:30:57 +00:00
Dmitri Hrybenko
d47fd41ac3 stdlib/Optional: add tests for trapping on unwrapping .None
rdar://16849500


Swift SVN r18343
2014-05-18 19:13:56 +00:00
Dave Abrahams
e0d37be053 [stdlib] Rename (Indexed=>Permutation)Generator
It was too easily confused with IndexingGenerator, which, come to think
of it may be obsolete.  It's just a PermutationGenerator with
startIndex..endIndex in the indices sequence.

Swift SVN r18341
2014-05-18 19:03:26 +00:00
Dave Abrahams
215da18af9 [stdlib] Publicize Map, add lazy map()
As declared, Dictionary's keys and values were private.  Instead of
hiding Map away as _Map, give it a "nice" verbose name and expose it
through a "nice" lowercase global function called map(), which we
overload so it works on both Collections and Sequences, returning a
Collection when that's what it started on.

We'll follow this pattern for filter, which was requested on Array.  The
implementation is easy once you have a lazy view!

Swift SVN r18340
2014-05-18 19:00:42 +00:00
Dave Abrahams
bec80488d0 [stdlib] Array API Review: insert:newElement:=>insert:AtIndex:
Swift SVN r18338
2014-05-18 17:43:16 +00:00
Dave Abrahams
200b89291c [stdlib] Array API review: privatize [bB]uffer
Swift SVN r18335
2014-05-18 17:32:00 +00:00
Dave Abrahams
8344b6dbb9 [stdlib] Array API Review: removeAt=>removeAtIndex
Swift SVN r18334
2014-05-18 17:32:00 +00:00
Dmitri Hrybenko
04e9f63483 stdlib/Array: add a test that arrays of non-Equatable elements are not
comparable with ==


Swift SVN r18333
2014-05-18 17:25:35 +00:00
Dave Abrahams
5846923729 [stdlib] Array API review: popLast => removeLast
Swift SVN r18331
2014-05-18 17:03:38 +00:00
Dave Abrahams
68abebdffb [stdlib] withUnsafePointerToElements for Array
Also privatize ArrayType's elementStorage. Per Array API review.

Swift SVN r18330
2014-05-18 16:59:46 +00:00
Dave Abrahams
92307dee66 [stdlib] Array API Review: swap init parameters
Swift SVN r18325
2014-05-18 15:54:33 +00:00
Dave Abrahams
2746a7d558 Another Array bridge/cast test from Doug
Applied that same workaround for <rdar://problem/16953026> in one more
place.

Swift SVN r18321
2014-05-18 06:15:45 +00:00