mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Type system support for raw pointer conversion. (#3685)
* [Type System] Handle raw pointer conversion. As proposed in SE-0107: UnsafeRawPointer. https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md#implicit-argument-conversion UnsafeMutablePointer<T> -> UnsafeMutableRawPointer UnsafeMutablePointer<T> -> UnsafeRawPointer UnsafePointer<T> -> UnsafeRawPointer UnsafeMutableRawPointer -> UnsafeRawPointer inout: &anyVar -> UnsafeMutableRawPointer &anyVar -> UnsafeRawPointer array -> UnsafeRawPointer string -> UnsafeRawPointer varArray -> UnsafeMutableRawPointer * Rename expectEqual(_, _, sameValue:) to expectEqualTest to workaround a type system bug. <rdar://26058520> Generic type constraints incorrectly applied to functions with the same name This is exposed by additions to the type system for UnsafeRawPointer. Warning: unit tests fail very confusingly without this fix.
This commit is contained in:
@@ -122,7 +122,7 @@ final class CodecTest<Codec : TestableUnicodeCodec> {
|
||||
default:
|
||||
fatalError("decoding failed")
|
||||
}
|
||||
expectEqual(
|
||||
expectEqualTest(
|
||||
scalar, decoded,
|
||||
"Decoding failed: \(asHex(scalar.value)) => " +
|
||||
"\(asHex(nsEncoded)) => \(asHex(decoded.value))"
|
||||
@@ -130,7 +130,7 @@ final class CodecTest<Codec : TestableUnicodeCodec> {
|
||||
|
||||
encodeIndex = encodeBuffer.startIndex
|
||||
Codec.encode(scalar, into: encodeOutput)
|
||||
expectEqual(
|
||||
expectEqualTest(
|
||||
nsEncoded, encodeBuffer[0..<encodeIndex],
|
||||
"Decoding failed: \(asHex(nsEncoded)) => " +
|
||||
"\(asHex(scalar.value)) => \(asHex(self.encodeBuffer[0]))"
|
||||
|
||||
Reference in New Issue
Block a user