You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_ =(str ??"")asString // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}}
_ = c1 as?NotConformsFinal // expected-warning {{cast from 'any ProtocolP & Composition' (aka 'any ProtocolP & ProtocolP1 & ProtocolQ1') to unrelated type 'NotConformsFinal' always fails}}
491
495
}
492
496
493
-
// SR-13899
494
-
classSR13899_Base{}
495
-
classSR13899_Derived:SR13899_Base{}
496
-
497
-
protocolSR13899_P{}
498
-
classSR13899_A:SR13899_P{}
499
-
500
-
typealiasDA=SR13899_Derived
501
-
typealiasBA=SR13899_Base
502
-
typealiasClosureType=(SR13899_Derived)->Void
503
-
504
-
letblockp={(_:SR13899_A)in}
505
-
letblock={(_:SR13899_Base)in}
506
-
letderived={(_:SR13899_Derived)in}
507
-
508
-
letblockalias={(_:BA)in}
509
-
letderivedalias={(_:DA)in}
510
-
511
-
let _ = block is ClosureType // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to 'ClosureType' (aka '(SR13899_Derived) -> ()') is not supported; 'is' test always fails}}
512
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-17=as}}
513
-
let _ = blockalias is (SR13899_Derived)->Void // expected-warning{{runtime conversion from '(BA) -> ()' (aka '(SR13899_Base) -> ()') to '(SR13899_Derived) -> Void' is not supported; 'is' test always fails}}
514
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{20-22=as}}
515
-
let _ = block is (SR13899_Derived)->Void // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to '(SR13899_Derived) -> Void' is not supported; 'is' test always fails}}
516
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-17=as}}
517
-
let _ = block is (SR13899_Derived)->Void // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to '(SR13899_Derived) -> Void' is not supported; 'is' test always fails}}
518
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-17=as}}
519
-
520
-
let _ = block as!ClosureType // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to 'ClosureType' (aka '(SR13899_Derived) -> ()') is not supported; cast always fails}}
521
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-18=as}}
522
-
let _ = blockalias as!(SR13899_Derived)->Void // expected-warning{{runtime conversion from '(BA) -> ()' (aka '(SR13899_Base) -> ()') to '(SR13899_Derived) -> Void' is not supported; cast always fails}}
523
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{20-23=as}}
524
-
let _ = block as!(SR13899_Derived)->Void // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to '(SR13899_Derived) -> Void' is not supported; cast always fails}}
525
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-18=as}}
526
-
let _ = block as!(SR13899_Derived)->Void // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to '(SR13899_Derived) -> Void' is not supported; cast always fails}}
527
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-18=as}}
528
-
529
-
let _ = block as?ClosureType // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to 'ClosureType' (aka '(SR13899_Derived) -> ()') is not supported; cast always fails}}
530
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-18=as}}
531
-
let _ = blockalias as?(SR13899_Derived)->Void // expected-warning{{runtime conversion from '(BA) -> ()' (aka '(SR13899_Base) -> ()') to '(SR13899_Derived) -> Void' is not supported; cast always fails}}
532
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{20-23=as}}
533
-
let _ = block as?(SR13899_Derived)->Void // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to '(SR13899_Derived) -> Void' is not supported; cast always fails}}
534
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-18=as}}
535
-
let _ = block as?(SR13899_Derived)->Void // expected-warning{{runtime conversion from '(SR13899_Base) -> ()' to '(SR13899_Derived) -> Void' is not supported; cast always fails}}
536
-
// expected-note@-1 {{consider using 'as' coercion instead}} {{15-18=as}}
537
-
538
-
539
-
let _ = derived is (SR13899_Base)->Void // expected-warning{{always fails}}
540
-
let _ = blockp is (SR13899_P)->Void // expected-warning{{always fails}}
541
-
542
-
// Types are trivially equal.
543
-
let _ = block is (SR13899_Base)->Void // expected-warning{{'is' test is always true}}
544
-
let _ = block is (SR13899_Base)throws->Void // expected-warning{{'is' test is always true}}
545
-
let _ = derivedalias is (SR13899_Derived)->Void // expected-warning{{'is' test is always true}}
546
-
let _ = derivedalias is (SR13899_Derived)throws->Void // expected-warning{{'is' test is always true}}
547
-
let _ = derived is (SR13899_Derived)->Void // expected-warning{{'is' test is always true}}
548
-
let _ = derived is (SR13899_Derived)throws->Void // expected-warning{{'is' test is always true}}
549
-
let _ = blockp is (SR13899_A)->Void //expected-warning{{'is' test is always true}}
550
-
let _ = blockp is (SR13899_A)throws->Void //expected-warning{{'is' test is always true}}
497
+
// https://github.com/apple/swift/issues/56297
498
+
499
+
classC1_56297_Base{}
500
+
classC1_56297_Sub:C1_56297_Base{}
501
+
502
+
protocolP_56297{}
503
+
classC2_56297:P_56297{}
504
+
505
+
do{
506
+
typealiasDA=C1_56297_Sub
507
+
typealiasBA=C1_56297_Base
508
+
typealiasClosureType=(C1_56297_Sub)->Void
509
+
510
+
letblockp={(_:C2_56297)in}
511
+
letblock={(_:C1_56297_Base)in}
512
+
letderived={(_:C1_56297_Sub)in}
513
+
514
+
letblockalias={(_:BA)in}
515
+
letderivedalias={(_:DA)in}
516
+
517
+
let _ = block is ClosureType // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to 'ClosureType' (aka '(C1_56297_Sub) -> ()') is not supported; 'is' test always fails}}
518
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-19=as}}
519
+
let _ = blockalias is (C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(BA) -> ()' (aka '(C1_56297_Base) -> ()') to '(C1_56297_Sub) -> Void' is not supported; 'is' test always fails}}
520
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{22-24=as}}
521
+
let _ = block is (C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to '(C1_56297_Sub) -> Void' is not supported; 'is' test always fails}}
522
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-19=as}}
523
+
let _ = block is (C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to '(C1_56297_Sub) -> Void' is not supported; 'is' test always fails}}
524
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-19=as}}
525
+
526
+
let _ = block as!ClosureType // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to 'ClosureType' (aka '(C1_56297_Sub) -> ()') is not supported; cast always fails}}
527
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-20=as}}
528
+
let _ = blockalias as!(C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(BA) -> ()' (aka '(C1_56297_Base) -> ()') to '(C1_56297_Sub) -> Void' is not supported; cast always fails}}
529
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{22-25=as}}
530
+
let _ = block as!(C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to '(C1_56297_Sub) -> Void' is not supported; cast always fails}}
531
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-20=as}}
532
+
let _ = block as!(C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to '(C1_56297_Sub) -> Void' is not supported; cast always fails}}
533
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-20=as}}
534
+
535
+
let _ = block as?ClosureType // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to 'ClosureType' (aka '(C1_56297_Sub) -> ()') is not supported; cast always fails}}
536
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-20=as}}
537
+
let _ = blockalias as?(C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(BA) -> ()' (aka '(C1_56297_Base) -> ()') to '(C1_56297_Sub) -> Void' is not supported; cast always fails}}
538
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{22-25=as}}
539
+
let _ = block as?(C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to '(C1_56297_Sub) -> Void' is not supported; cast always fails}}
540
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-20=as}}
541
+
let _ = block as?(C1_56297_Sub)->Void // expected-warning{{runtime conversion from '(C1_56297_Base) -> ()' to '(C1_56297_Sub) -> Void' is not supported; cast always fails}}
542
+
// expected-note@-1 {{consider using 'as' coercion instead}} {{17-20=as}}
543
+
544
+
545
+
let _ = derived is (C1_56297_Base)->Void // expected-warning{{always fails}}
546
+
let _ = blockp is (P_56297)->Void // expected-warning{{always fails}}
547
+
548
+
// Types are trivially equal.
549
+
let _ = block is (C1_56297_Base)->Void // expected-warning{{'is' test is always true}}
550
+
let _ = block is (C1_56297_Base)throws->Void // expected-warning{{'is' test is always true}}
551
+
let _ = derivedalias is (C1_56297_Sub)->Void // expected-warning{{'is' test is always true}}
552
+
let _ = derivedalias is (C1_56297_Sub)throws->Void // expected-warning{{'is' test is always true}}
553
+
let _ = derived is (C1_56297_Sub)->Void // expected-warning{{'is' test is always true}}
554
+
let _ = derived is (C1_56297_Sub)throws->Void // expected-warning{{'is' test is always true}}
555
+
let _ = blockp is (C2_56297)->Void //expected-warning{{'is' test is always true}}
556
+
let _ = blockp is (C2_56297)throws->Void //expected-warning{{'is' test is always true}}
557
+
}
551
558
552
559
protocolPP1{}
553
560
protocolPP2:PP1{}
554
561
extensionOptional:PP1where Wrapped ==PP2{}
555
562
556
563
nil is PP1 // expected-error {{'nil' requires a contextual type}}
557
564
558
-
// SR-15039
565
+
// https://github.com/apple/swift/issues/57366
566
+
559
567
enumChangeType<T>{
560
568
case initial(T)
561
569
case delta(previous:T, next:T)
@@ -569,7 +577,8 @@ extension ChangeType where T == String? {
0 commit comments