Skip to content

Commit f7837c1

Browse files
Suyash SrijanSuyash Srijan
authored andcommitted
[test] update cast diagnostics for existing tests
1 parent 524790e commit f7837c1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

test/Constraints/casts.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func protocol_concrete_casts(_ p1: P1, p2: P2, p12: P1 & P2) {
111111

112112
_ = p1 as! P1 & P2
113113

114-
_ = p2 as! S1
114+
_ = p2 as! S1 // expected-warning {{cast from 'P2' to unrelated type 'S1' always fails}}
115115

116116
_ = p12 as! S1
117117
_ = p12 as! S2
@@ -126,7 +126,7 @@ func protocol_concrete_casts(_ p1: P1, p2: P2, p12: P1 & P2) {
126126

127127
var _:Bool = p1 is P1 & P2
128128

129-
var _:Bool = p2 is S1
129+
var _:Bool = p2 is S1 // expected-warning {{cast from 'P2' to unrelated type 'S1' always fails}}
130130

131131
var _:Bool = p12 is S1
132132
var _:Bool = p12 is S2
@@ -153,9 +153,9 @@ func objc_protocol_casts(_ op1: ObjCProto1, opn: NonObjCProto) {
153153
_ = ObjCClass() as! ObjCProto1 & NonObjCProto
154154

155155
_ = op1 as! ObjCProto1 & ObjCProto2
156-
_ = op1 as! ObjCProto2
156+
_ = op1 as! ObjCProto2 // expected-warning {{cast from 'ObjCProto1' to unrelated type 'ObjCProto2' always fails}}
157157
_ = op1 as! ObjCProto1 & NonObjCProto
158-
_ = opn as! ObjCProto1
158+
_ = opn as! ObjCProto1 // expected-warning {{cast from 'NonObjCProto' to unrelated type 'ObjCProto1' always fails}}
159159

160160
_ = NonObjCClass() as! ObjCProto1
161161
}

test/Constraints/patterns.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ case is B,
5555
is D,
5656
is S:
5757
()
58-
case is E:
58+
case is E: // expected-warning {{cast from 'P' to unrelated type 'E' always fails}}
5959
()
6060
default:
6161
()
@@ -69,7 +69,7 @@ case let d as D:
6969
d.d()
7070
case let s as S:
7171
s.s()
72-
case let e as E:
72+
case let e as E: // expected-warning {{cast from 'P' to unrelated type 'E' always fails}}
7373
e.e()
7474
default:
7575
()
@@ -120,7 +120,7 @@ case iPadHair<E>.HairForceOne:
120120
()
121121
case iPadHair.HairForceOne: // expected-error{{generic enum type 'iPadHair' is ambiguous without explicit generic parameters when matching value of type 'HairType'}}
122122
()
123-
case Watch.Edition: // TODO: should warn that cast can't succeed with currently known conformances
123+
case Watch.Edition: // expected-warning {{cast from 'HairType' to unrelated type 'Watch' always fails}}
124124
()
125125
case .HairForceOne: // expected-error{{type 'HairType' has no member 'HairForceOne'}}
126126
()

0 commit comments

Comments
 (0)