Skip to content

Commit ad83b21

Browse files
committed
Add another test case to test/Constraints/sr12365.swift
This one was reduced from <rdar://problem/66492626>, which we have decided is an acceptable source break because the old behavior was incorrect.
1 parent b647245 commit ad83b21

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/Constraints/sr12365.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@ func check(a: Double, b: Int64) -> Bool {
1616
return a != 0 && b != 0 // Okay
1717
}
1818

19-
func check() {
19+
func check1() {
2020
let x: Int = 1
2121
let _ = UInt(1) << x - 1 // Okay
2222
let _ = UInt(1) << (x + 1) - 1 // Okay
2323
}
24+
25+
func check2() {
26+
let a: UInt32 = 0
27+
let b: UInt32 = 1 << (a + 16)
28+
let _ = a & b // Okay
29+
}
30+
31+
func check3() {
32+
let a: UInt32 = 0
33+
let b = 1 << (a + 16)
34+
let _ = a & b // Not okay, because 'b: Int'!
35+
// expected-error@-1 {{binary operator '&' cannot be applied to operands of type 'UInt32' and 'Int'}}
36+
// expected-note@-2 {{overloads for '&' exist with these partially matching parameter lists: (Int, Int), (UInt32, UInt32)}}
37+
}

0 commit comments

Comments
 (0)