Skip to content

Commit 6379387

Browse files
authored
Merge pull request #31883 from gribozavr/enable-unicodescalar-test
Reenable a test for UnicodeScalar
2 parents 772207a + 3f5c53a commit 6379387

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed
Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
1-
// FIXME(integers): confusing diagnostics when new integer protocols are
2-
// implemented. <rdar://problem/29912193>
3-
// XFAIL: *
4-
51
// RUN: %target-typecheck-verify-swift
62

3+
// FIXME: The clarity of these diagnostics could be improved.
4+
// <rdar://problem/29912193>
5+
76
func isString(_ s: inout String) {}
87

98
func test_UnicodeScalarDoesNotImplementArithmetic(_ us: UnicodeScalar, i: Int) {
109
var a1 = "a" + "b" // OK
1110
isString(&a1)
1211
let a2 = "a" - "b" // expected-error {{binary operator '-' cannot be applied to two 'String' operands}}
13-
// expected-note @-1 {{overloads for '-' exist with these partially matching parameter lists:}}
1412
let a3 = "a" * "b" // expected-error {{binary operator '*' cannot be applied to two 'String' operands}}
15-
// expected-note @-1 {{overloads for '*' exist with these partially matching parameter lists:}}
1613
let a4 = "a" / "b" // expected-error {{binary operator '/' cannot be applied to two 'String' operands}}
17-
// expected-note @-1 {{overloads for '/' exist with these partially matching parameter lists:}}
1814

19-
let b1 = us + us // expected-error {{binary operator '+' cannot be applied to two 'UnicodeScalar' operands}}
20-
// expected-note @-1 {{overloads for '+' exist with these partially matching parameter lists:}}
21-
let b2 = us - us // expected-error {{binary operator '-' cannot be applied to two 'UnicodeScalar' operands}}
22-
// expected-note @-1 {{overloads for '-' exist with these partially matching parameter lists:}}
23-
let b3 = us * us // expected-error {{binary operator '*' cannot be applied to two 'UnicodeScalar' operands}}
24-
// expected-note @-1 {{overloads for '*' exist with these partially matching parameter lists:}}
25-
let b4 = us / us // expected-error {{binary operator '/' cannot be applied to two 'UnicodeScalar' operands}}
26-
// expected-note @-1 {{overloads for '/' exist with these partially matching parameter lists:}}
15+
let b1 = us + us // expected-error {{referencing operator function '+' on 'RangeReplaceableCollection' requires that 'UnicodeScalar' (aka 'Unicode.Scalar') conform to 'RangeReplaceableCollection'}}
16+
let b2 = us - us // expected-error {{referencing operator function '-' on 'FloatingPoint' requires that 'UnicodeScalar' (aka 'Unicode.Scalar') conform to 'FloatingPoint'}}
17+
let b3 = us * us // expected-error {{referencing operator function '*' on 'FloatingPoint' requires that 'UnicodeScalar' (aka 'Unicode.Scalar') conform to 'FloatingPoint'}}
18+
let b4 = us / us // expected-error {{referencing operator function '/' on 'FloatingPoint' requires that 'UnicodeScalar' (aka 'Unicode.Scalar') conform to 'FloatingPoint'}}
2719

28-
let c1 = us + i // expected-error {{binary operator '+' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{overloads for '+' exist with these partially matching parameter lists:}}
29-
let c2 = us - i // expected-error {{binary operator '-' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note{{overloads for '-' exist with these partially matching parameter lists: (UnsafeMutablePointer<Pointee>, Int), (UnsafePointer<Pointee>, Int)}}
30-
let c3 = us * i // expected-error {{binary operator '*' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note {{expected an argument list of type '(Int, Int)'}}
31-
let c4 = us / i // expected-error {{binary operator '/' cannot be applied to operands of type 'UnicodeScalar' and 'Int'}} expected-note {{expected an argument list of type '(Int, Int)'}}
20+
let c1 = us + i // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
21+
let c2 = us - i // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
22+
let c3 = us * i // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
23+
let c4 = us / i // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
3224

33-
let d1 = i + us // expected-error {{binary operator '+' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note{{overloads for '+' exist with these partially matching parameter lists:}}
34-
let d2 = i - us // expected-error {{binary operator '-' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note {{expected an argument list of type '(Int, Int)'}}
35-
let d3 = i * us // expected-error {{binary operator '*' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note {{expected an argument list of type '(Int, Int)'}}
36-
let d4 = i / us // expected-error {{binary operator '/' cannot be applied to operands of type 'Int' and 'UnicodeScalar'}} expected-note {{expected an argument list of type '(Int, Int)'}}
25+
let d1 = i + us // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
26+
let d2 = i - us // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
27+
let d3 = i * us // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
28+
let d4 = i / us // expected-error {{cannot convert value of type 'UnicodeScalar' (aka 'Unicode.Scalar') to expected argument type 'Int'}}
3729
}
3830

0 commit comments

Comments
 (0)