Update for SE-0107: UnsafeRawPointer
This adds a "mutating" initialize to UnsafePointer to make
Immutable -> Mutable conversions explicit.
These are quick fixes to stdlib, overlays, and test cases that are necessary
in order to remove arbitrary UnsafePointer conversions.
Many cases can be expressed better up by reworking the surrounding
code, but we first need a working starting point.
These provide the same functionality as the one-argument versions for both
2 and 3 argument closures. Since these are less common, the same thing can be
achieved by composing the one-argument version. rdar://problem/26529498
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.
As proposed in SE-0107: UnsafeRawPointer.
`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.
Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.
* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.
This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.
* Fix a bunch of test cases for Void->Raw migration.
* qsort takes IUO values
* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.
* Parse #dsohandle as UnsafeMutableRawPointer
* Update a bunch of test cases for Void->Raw migration.
* Trivial fix for the SceneKit test case.
* Add an UnsafeRawPointer self initializer.
This is unfortunately necessary for assignment between types imported from C.
* Tiny simplification of the initializer.
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.
As proposed in SE-0107: UnsafeRawPointer.
`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.
Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.
* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.
This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.
* Fix a bunch of test cases for Void->Raw migration.
* qsort takes IUO values
* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.
* Parse #dsohandle as UnsafeMutableRawPointer
* Update a bunch of test cases for Void->Raw migration.
* Trivial fix for the SceneKit test case.
* Add an UnsafeRawPointer self initializer.
This is unfortunately necessary for assignment between types imported from C.
* Tiny simplification of the initializer.
All generic bridgeable types can bridge for all their instantiations now. Removing this ferrets out some now-unnecessary traps that check for unbridgeable parameter types.
Relax some preconditions in the cast machinery and write a comprehensive
test suite.
FIXMEs in test/1_stdlib/HashedCollectionCasts.swift.gyb show where the
typechecker doesn't seem to quite work, or the frontend might be
generating the wrong runtime calls.
TODO: Add tests for failing downcasts
Relax some preconditions in the cast machinery and write a comprehensive
test suite.
FIXMEs in test/1_stdlib/HashedCollectionCasts.swift.gyb show where the
typechecker doesn't seem to quite work, or the frontend might be
generating the wrong runtime calls.
TODO: Add tests for failing downcasts
change includes both the necessary protocol updates and the deprecation
warnings
suitable for migration. A future patch will remove the renamings and
make this
a hard error.
Added tests for expected-error and fix-its.
- Add arguments signature regardless that is the same as before.
Because the error message looks more natural.
e.g. "makeIterator" => "makeIterator()",
"replaceSubrange" => "replaceSubrange(_:with:)"
- Any${ExistentialCollection}.underestimateCount() was a method, not
computed property.
- 'LazySequenceType' has been renamed to 'LazySequenceProtocol', but not
'LazyCollectionProtocol'
- Streamable.writeTo(_:) had no argument label.
- Fixed typo in print() debugPrint() error message (not working for now)
- Repeated.init(): changed `renamed` to `message` because the arugment
order has changed.
- Marked `public` for some unavailable method on `Sequence`
- Sequence.split(_:maxSplit:allowEmptySlices) was replaced with
split(separator:maxSplits:omittingEmptySubsequences:),
not split(separator:omittingEmptySubsequences:isSeparator:)
- Sequence.split(_:allowEmptySlices:isSeparator) was replaced with
split(maxSplits:omittingEmptySubsequences:isSeparator:),
not split(_:omittingEmptySubsequences:isSeparator:)
- Sequence.startsWith(_:isEquivalent:) or startsWith(_:) had no label on
the first argument.
- transcode(_:_:_:_:stopOnError), not transcode(_:_:_:_:stoppingOnError)
- Removed mutating methods from UnsafePointer.
alloc(_:), dealloc(_:), setter:memory, initialize(_:), destroy(),
and destroy(_:)
Due to a modeling error in the type checker's folding of type
references into type expressions, code such as "strideof(Int)" would
be accepted without the required ".self". Commit
4a60b6cbf4 fixes the modeling issue but
left the historical accepts-invalid; now, diagnose these cases with a
warning + Fix-It to ease the transition.
Fixes SR-899.
This documentation revision covers a large number of types & protocols:
String, its views and their indices, the Unicode codec types and protocol,
as well as Character, UnicodeScalar, and StaticString, among others.
This also includes a few small changes across the standard library for
consistency.