You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These tests were fixed by:
[TypeChecker] SE-0324: Extend Swift -> C pointer conversions to arrays
The unit tests in diagnose_implicit_raw_conversion.swift
are now replete.
readBytes(constArray) // expected-warning {{forming 'UnsafeRawPointer' to a variable of type '[T]'; this is likely incorrect because 'T' may contain an object reference.}}
41
+
read_char(constArray) // expected-warning {{forming 'UnsafePointer<CChar>' (aka 'UnsafePointer<Int8>') to a variable of type '[T]'; this is likely incorrect because 'T' may contain an object reference.}}
42
+
read_uchar(constArray) // expected-warning {{forming 'UnsafePointer<UInt8>' to a variable of type '[T]'; this is likely incorrect because 'T' may contain an object reference.}}
41
43
42
44
vararray:[T]=[arg]
43
45
readBytes(&array) // expected-warning {{forming 'UnsafeRawPointer' to a variable of type '[T]'; this is likely incorrect because 'T' may contain an object reference.}}
writeInt8(&byteArray) // expected-error {{cannot convert value of type 'UnsafeMutablePointer<UInt8>' to expected argument type 'UnsafeMutablePointer<Int8>'}}
40
40
// expected-note@-1 {{arguments to generic parameter 'Pointee' ('UInt8' and 'Int8') are expected to be equal}}
41
41
}
42
-
43
-
// Array<T> to C pointer conversion is supported under SE-0324
44
-
func test_array_to_c_pointer_concrete(){
45
-
letconstIntArray:[Int8]=[0]
46
-
read_uchar(constIntArray)
47
-
48
-
letconstUIntArray:[UInt8]=[0]
49
-
read_char(constUIntArray)
50
-
51
-
varintArray:[Int8]=[0] // expected-warning {{variable 'intArray' was never mutated; consider changing to 'let' constant}}
52
-
read_uchar(intArray)
53
-
54
-
varuintArray:[UInt8]=[0] // expected-warning {{variable 'uintArray' was never mutated; consider changing to 'let' constant}}
55
-
read_char(uintArray)
56
-
57
-
}
58
-
59
-
// Array<T> to C pointer conversion is supported under SE-0324
0 commit comments