@@ -22,6 +22,58 @@ var u32 : UInt32 = u // expected-error {{'UInt' is not convertible to 'UInt32'}}
22
22
var u16 : UInt16 = u // expected-error {{'UInt' is not convertible to 'UInt16'}}
23
23
var u8 : UInt8 = u // expected-error {{'UInt' is not convertible to 'UInt8'}}
24
24
25
+ func expectSameType< T> ( _: T . Type , _: T . Type ) { }
26
+
27
+ func test_truncatingBitPatternAPIIsStableAcrossPlatforms( ) {
28
+ // Audit and update this test when adding new integer types.
29
+ expectSameType ( Int64 . self, IntMax . self)
30
+ expectSameType ( UInt64 . self, UIntMax . self)
31
+
32
+ UInt8 ( truncatingBitPattern: UInt ( 0 ) )
33
+ UInt16 ( truncatingBitPattern: UInt ( 0 ) )
34
+ UInt32 ( truncatingBitPattern: UInt ( 0 ) )
35
+ UInt64 ( truncatingBitPattern: UInt ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
36
+ UInt ( truncatingBitPattern: UInt ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
37
+
38
+ Int8 ( truncatingBitPattern: UInt ( 0 ) )
39
+ Int16 ( truncatingBitPattern: UInt ( 0 ) )
40
+ Int32 ( truncatingBitPattern: UInt ( 0 ) )
41
+ Int64 ( truncatingBitPattern: UInt ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
42
+ Int ( truncatingBitPattern: UInt ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
43
+
44
+ UInt8 ( truncatingBitPattern: Int ( 0 ) )
45
+ UInt16 ( truncatingBitPattern: Int ( 0 ) )
46
+ UInt32 ( truncatingBitPattern: Int ( 0 ) )
47
+ UInt64 ( truncatingBitPattern: Int ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
48
+ UInt ( truncatingBitPattern: Int ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
49
+
50
+ Int8 ( truncatingBitPattern: Int ( 0 ) )
51
+ Int16 ( truncatingBitPattern: Int ( 0 ) )
52
+ Int32 ( truncatingBitPattern: Int ( 0 ) )
53
+ Int64 ( truncatingBitPattern: Int ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
54
+ Int ( truncatingBitPattern: Int ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
55
+
56
+ UInt ( truncatingBitPattern: UInt8 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
57
+ UInt ( truncatingBitPattern: UInt16 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
58
+ UInt ( truncatingBitPattern: UInt32 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
59
+ UInt ( truncatingBitPattern: UInt64 ( 0 ) )
60
+
61
+ Int ( truncatingBitPattern: UInt8 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
62
+ Int ( truncatingBitPattern: UInt16 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
63
+ Int ( truncatingBitPattern: UInt32 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
64
+ Int ( truncatingBitPattern: UInt64 ( 0 ) )
65
+
66
+ UInt ( truncatingBitPattern: Int8 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
67
+ UInt ( truncatingBitPattern: Int16 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
68
+ UInt ( truncatingBitPattern: Int32 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
69
+ UInt ( truncatingBitPattern: Int64 ( 0 ) )
70
+
71
+ Int ( truncatingBitPattern: Int8 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
72
+ Int ( truncatingBitPattern: Int16 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
73
+ Int ( truncatingBitPattern: Int32 ( 0 ) ) // expected-error {{extraneous argument label 'truncatingBitPattern:' in call}}
74
+ Int ( truncatingBitPattern: Int64 ( 0 ) )
75
+ }
76
+
25
77
func testOps< T : IntegerArithmeticType > ( x: T , y: T ) -> T {
26
78
let a = x + y
27
79
let s = x - y
0 commit comments