Commit Graph

187 Commits

Author SHA1 Message Date
Jordan Rose
bc83940301 Make pointer nullability explicit using Optional.
Implements SE-0055: https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md

- Add NULL as an extra inhabitant of Builtin.RawPointer (currently
  hardcoded to 0 rather than being target-dependent).
- Import non-object pointers as Optional/IUO when nullable/null_unspecified
  (like everything else).
- Change the type checker's *-to-pointer conversions to handle a layer of
  optional.
- Use 'AutoreleasingUnsafeMutablePointer<NSError?>?' as the type of error
  parameters exported to Objective-C.
- Drop NilLiteralConvertible conformance for all pointer types.
- Update the standard library and then all the tests.

I've decided to leave this commit only updating existing tests; any new
tests will come in the following commits. (That may mean some additional
implementation work to follow.)

The other major piece that's missing here is migration. I'm hoping we get
a lot of that with Swift 1.1's work for optional object references, but
I still need to investigate.
2016-04-11 20:06:38 -07:00
Dmitri Gribenko
d52cbab5c2 Merge commit '0ff3239b962218267d37307e53906b31315a1cfc' into swift-3-indexing-model
This commit is the parent of the commit that implemented SE-0046
Establish consistent label behavior across all parameters including
first labels
2016-04-09 16:18:33 -07:00
Dmitri Gribenko
9169c37802 Use check*AssociatedTypes() on Set and Dictionary 2016-04-08 18:46:00 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Dmitri Gribenko
6985b958fd Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-04 11:42:17 -07:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
Dmitri Gribenko
5a12349e9c Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-01 14:12:13 -07:00
Slava Pestov
49c54870c1 Serialization: Auto-linking recursively walks modules imported from -sil-serialize-all modules 2016-04-01 12:21:36 -07:00
Han Sangjin
5c1854bfcf stdlib: Portable random function
Changed rand32() implementation using a random engine in C++11 <random>.
2016-03-31 04:39:46 +09:00
Max Moiseev
cf92a80830 [stdlib][swift-3-indexing-model] making Set validation tests pass 2016-03-22 11:57:05 -07:00
Doug Gregor
d92ae77076 Eliminate most remaining uses of _convertNSFooToFoo and _convertFooToNSFoo.
Generalized bridging has fully subsumed most of these. NSError is
still special, and _convertStringToNSString remains for the the
runtime's implementation of SwiftObject's -description method.
2016-03-18 11:42:00 -07:00
Max Moiseev
7fe6916bf6 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-07 12:10:47 -08:00
Emanuel Zephir
a4e8ee04e0 [StdLib] Refactor DictionaryKeyValueTypes test input data
Split the input file into a pure Swift and Objective-C interop files in
anticipation of refactoring tests to remove XFAILs on Linux.
2016-02-29 22:49:35 -08:00
Jordan Rose
e45dfe09c6 stdlib: Rename 'Native'/'Cocoa' representations inside Dictionary/Set.
...and then because of a compiler bug (SR-806), rename the helper
properties to 'asNative' and 'asCocoa'.

None of this is API, so there is no migration information.
2016-02-24 17:46:12 -08:00
Max Moiseev
bb3eaaf308 Merging in latest master 2016-02-24 15:10:25 -08:00
Janosch Hildebrand
3c4bb1d657 [stdlib] Replace uses of ++ in validation tests 2016-02-24 01:59:18 +01:00
Max Moiseev
42d5f30d3a Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-api-guidelines 2016-02-23 14:45:21 -08:00
Max Moiseev
0b759a409c Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-23 14:26:14 -08:00
Dmitri Gribenko
f0633ce5a9 stdlib: Sequence.iterator() => .makeIterator() 2016-02-23 13:52:30 -08:00
Max Moiseev
52f0cf49b0 [stdlib] indexOf => index(of:)/index(where:) 2016-02-23 11:45:11 -08:00
Dmitri Gribenko
dd75aed67a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-17 14:40:05 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Dmitri Gribenko
4c590585e0 Move Default* and Minimal* colections to StdlibCollectionUnittest
New StdlibUnittest build times:

* DebugAssert compiler and library: 50s
* ReleaseAssert compiler and library: 75s
2016-01-26 18:58:04 -08:00
Dmitri Gribenko
9bcd5a1056 Collection.length => .count 2016-01-22 18:41:19 -08:00
Erik Eckstein
adef0368bb tests: add import statements to workaround linker errors in all relevant tests.
This is needed if we compile StdlibUnittest with -sil-serialize-all
So far I added the imports only in files which needed them. But this may change, depending on the optimizer (inlining).
Adding them in all files doesn't harm and avoids confusion if someone makes an unrelated change which would result in such a linker error.
2016-01-21 09:59:50 -08:00
Max Moiseev
200be71583 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-23 10:28:04 -08:00
Max Moiseev
a7339e67ac Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-22 11:36:07 -08:00
ken0nek
fcd8fcee91 Convert [Cc]an not -> [Cc]annot 2015-12-23 00:55:48 +09:00
Dmitri Gribenko
87bd89161d Merge pull request #455 from frootloops/uniform-random
FIXME: swift/validation-test/stdlib/Set.swift:95
2015-12-21 23:36:50 -08:00
Dmitri Gribenko
8f7c9ae3fd Collection.sort() => .sorted() 2015-12-18 16:20:01 -08:00
Doug Gregor
2091e7f852 Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-omit-needless-words 2015-12-18 10:54:46 -08:00
Dmitri Gribenko
73ce9ae7e9 Collection.count => .length
And other API changes that naturally fall out from this, like
Array(repeating:count:) => Array(repeating:length:).
2015-12-17 15:55:29 -08:00
Doug Gregor
2f5f94a12c Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-omit-needless-words 2015-12-15 17:11:37 -08:00
Max Moiseev
806be29941 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-14 12:05:35 -08:00
Arsen Gasparyan
52890e5c30 Replace if true {} with do {} 2015-12-13 10:54:54 +03:00
Arsen Gasparyan
3961b71e4e Use real arc4random_uniform() instead of just random() % max 2015-12-13 10:17:35 +03:00
Doug Gregor
06c5e9cd5b Enable "omit needless words" by default.
Most of this is in updating the standard library, SDK overlays, and
piles of test cases to use the new names. No surprises here, although
this shows us some potential heuristic tweaks.

There is one substantive compiler change that needs to be factored out
involving synthesizing calls to copyWithZone()/copy(zone:). Aside from
that, there are four failing tests:

    Swift :: ClangModules/objc_parse.swift
    Swift :: Interpreter/SDK/Foundation_test.swift
    Swift :: Interpreter/SDK/archiving_generic_swift_class.swift
    Swift :: Interpreter/SDK/objc_currying.swift

due to two independent remaining compiler bugs:
  * We're not getting partial ordering between NSCoder's
  encode(AnyObject, forKey: String) and NSKeyedArchiver's version of
  that method, and
  * Dynamic lookup (into AnyObject) doesn't know how to find the new
  names. We need the Swift name lookup tables enabled to address this.
2015-12-11 14:46:50 -08:00
Dmitri Gribenko
b7f3d54f4d removeAll(keepCapacity:) => removeAll(keepingCapacity:) 2015-12-09 17:18:08 -08:00
Maxim Moiseev
844b81c46b SequenceType => Sequence 2015-12-09 17:16:56 -08:00
Dmitri Gribenko
5a07f89297 Remove 'generator' from names of test functions and local variables 2015-12-09 17:15:11 -08:00
Dmitri Gribenko
4b1be0e78f removeAtIndex() => removeAt() 2015-12-09 17:15:01 -08:00
Maxim Moiseev
7e2466c14e CollectionType => Collection 2015-12-09 17:12:48 -08:00
Dmitri Gribenko
1c0047829a Rename SequenceType.generate() to SequenceType.iterator() 2015-12-09 17:11:17 -08:00
Dmitri Gribenko
2cf172160c Rename SequenceType.Generator associated type to SequenceType.Iterator 2015-12-09 17:11:05 -08:00
Dmitri Gribenko
31598d41bf Rename GeneratorType to IteratorProtocol 2015-12-07 17:08:32 -08:00
Dave Abrahams
383a0564f7 Warning suppression in tests
Swift SVN r31062
2015-08-06 22:13:03 +00:00
Dmitri Hrybenko
0c88bd93e9 stdlib: more tests for {Set,Dictionary}.removeAtIndex
Swift SVN r30702
2015-07-27 23:12:00 +00:00
Jordan Rose
b378a5043f [stdlib] Dictionary and Set's removeAtIndex should return the element.
For Dictionary, that's a (KeyType, ValueType) pair. For Set, that's just
the set element type. This is more consistent with the removeAtIndex on
RangeReplaceableCollectionType (which Dictionary and Set don't conform to).

rdar://problem/20299881

Swift SVN r30696
2015-07-27 20:32:55 +00:00