Skip to content

Commit 1352878

Browse files
committed
[TypeChecker] NFC: Add a test-case for rdar://problem/60185506
1 parent 0ecedfa commit 1352878

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

test/Constraints/operator.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,14 @@ extension Int {
254254
}
255255

256256
_ = 1 ^^ 2 ^^ 3 * 4 // expected-error {{adjacent operators are in unordered precedence groups 'PowerPrecedence' and 'MultiplicationPrecedence'}}
257+
258+
// rdar://problem/60185506 - Ambiguity with Float comparison
259+
func rdar_60185506() {
260+
struct X {
261+
var foo: Float
262+
}
263+
264+
func test(x: X?) {
265+
let _ = (x?.foo ?? 0) <= 0.5 // Ok
266+
}
267+
}

test/attr/attr_dynamic_member_lookup.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,8 @@ func keypath_with_subscripts(_ arr: SubscriptLens<[Int]>,
601601
func keypath_with_incorrect_return_type(_ arr: Lens<Array<Int>>) {
602602
for idx in 0..<arr.count {
603603
// expected-error@-1 {{protocol 'Sequence' requires that 'Lens<Int>' conform to 'Strideable'}}
604-
// expected-error@-2 {{protocol 'Sequence' requires that 'Lens<Int>.Stride' conform to 'SignedInteger'}}
605-
// expected-error@-3 {{cannot convert value of type 'Int' to expected argument type 'Lens<Int>'}}
606-
// expected-error@-4 {{referencing operator function '..<' on 'Comparable' requires that 'Lens<Int>' conform to 'Comparable'}}
604+
// expected-error@-2 {{cannot convert value of type 'Int' to expected argument type 'Lens<Int>'}}
605+
// expected-error@-3 {{referencing operator function '..<' on 'Comparable' requires that 'Lens<Int>' conform to 'Comparable'}}
607606
let _ = arr[idx]
608607
}
609608
}

0 commit comments

Comments
 (0)