@@ -243,3 +243,47 @@ func moreComplexUnwrapFixes() {
243
243
244
244
}
245
245
}
246
+
247
+ struct FooStruct {
248
+ func a( ) -> Int ? ? { return 10 }
249
+
250
+ var b : Int ? ? {
251
+ return 15
252
+ }
253
+
254
+ func c( ) -> Int ? ? ? { return 20 }
255
+
256
+ var d : Int ? ? ? {
257
+ return 25
258
+ }
259
+
260
+ let e : BarStruct ? = BarStruct ( )
261
+ }
262
+
263
+ struct BarStruct {
264
+ func a( ) -> Int ? { return 30 }
265
+ var b : Int ? ? {
266
+ return 35
267
+ }
268
+ }
269
+
270
+ let thing : FooStruct ? = FooStruct ( )
271
+
272
+ let _: Int ? = thing? . a ( ) // expected-error {{value of optional type 'Int??' must be unwrapped to a value of type 'Int?'}}
273
+ // expected-note@-1{{coalesce}}
274
+ // expected-note@-2{{force-unwrap}}
275
+ let _: Int ? = thing? . b // expected-error {{value of optional type 'Int??' must be unwrapped to a value of type 'Int?'}}
276
+ // expected-note@-1{{coalesce}}
277
+ // expected-note@-2{{force-unwrap}}
278
+ let _: Int ? ? = thing? . c ( ) // expected-error {{value of optional type 'Int???' must be unwrapped to a value of type 'Int??'}}
279
+ // expected-note@-1{{coalesce}}
280
+ // expected-note@-2{{force-unwrap}}
281
+ let _: Int ? ? = thing? . d // expected-error {{value of optional type 'Int???' must be unwrapped to a value of type 'Int??'}}
282
+ // expected-note@-1{{coalesce}}
283
+ // expected-note@-2{{force-unwrap}}
284
+ let _: Int = thing? . e? . a ( ) // expected-error {{value of optional type 'Int?' must be unwrapped to a value of type 'Int'}}
285
+ // expected-note@-1{{coalesce}}
286
+ // expected-note@-2{{force-unwrap}}
287
+ let _: Int ? = thing? . e? . b // expected-error {{value of optional type 'Int??' must be unwrapped to a value of type 'Int?'}}
288
+ // expected-note@-1{{coalesce}}
289
+ // expected-note@-2{{force-unwrap}}
0 commit comments