Skip to content

Commit 5701d50

Browse files
committed
Add a test for bad diagnostic on '&&'.
This was fixed (probably by dd01b7e), so we should make sure it doesn't regress in the future.
1 parent 1f931f9 commit 5701d50

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/Constraints/diagnostics.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,11 @@ extension Foo23752537 {
737737
}
738738
}
739739

740+
// <rdar://problem/27391581> QoI: Nonsensical "binary operator '&&' cannot be applied to two 'Bool' operands"
741+
func rdar27391581(_ a : Int, b : Int) -> Int {
742+
return a == b && b != 0
743+
// expected-error @-1 {{cannot convert return expression of type 'Bool' to return type 'Int'}}
744+
}
740745

741746
// <rdar://problem/22276040> QoI: not great error message with "withUnsafePointer" sametype constraints
742747
func read2(_ p: UnsafeMutableRawPointer, maxLength: Int) {}

0 commit comments

Comments
 (0)