@@ -3566,145 +3566,6 @@ public func numericCast<T : BinaryInteger, U : BinaryInteger>(_ x: T) -> U {
3566
3566
return U ( x)
3567
3567
}
3568
3568
3569
- // FIXME(integers): These overloads allow expressions like the following in
3570
- // Swift 3 compatibility mode:
3571
- // let x = 1 << i32
3572
- // f(i32: x)
3573
- // At the same time, since they are obsolete in Swift 4, this will not cause
3574
- // `u8 << -1` to fail due to an overflow in an unsigned value.
3575
- extension FixedWidthInteger {
3576
- @available ( swift, obsoleted: 4 )
3577
- @_semantics ( " optimize.sil.specialize.generic.partial.never " )
3578
- @_transparent
3579
- public static func >>( lhs: Self , rhs: Self ) -> Self {
3580
- var lhs = lhs
3581
- _nonMaskingRightShiftGeneric ( & lhs, rhs)
3582
- return lhs
3583
- }
3584
-
3585
- @available ( swift, obsoleted: 4 )
3586
- @_semantics ( " optimize.sil.specialize.generic.partial.never " )
3587
- @_transparent
3588
- public static func >>= ( lhs: inout Self , rhs: Self ) {
3589
- _nonMaskingRightShiftGeneric ( & lhs, rhs)
3590
- }
3591
-
3592
- @available ( swift, obsoleted: 4 )
3593
- @_semantics ( " optimize.sil.specialize.generic.partial.never " )
3594
- @_transparent
3595
- public static func <<( lhs: Self , rhs: Self ) -> Self {
3596
- var lhs = lhs
3597
- _nonMaskingLeftShiftGeneric ( & lhs, rhs)
3598
- return lhs
3599
- }
3600
-
3601
- @available ( swift, obsoleted: 4 )
3602
- @_semantics ( " optimize.sil.specialize.generic.partial.never " )
3603
- @_transparent
3604
- public static func <<= ( lhs: inout Self , rhs: Self ) {
3605
- _nonMaskingLeftShiftGeneric ( & lhs, rhs)
3606
- }
3607
- }
3608
-
3609
- extension FixedWidthInteger {
3610
- @available ( swift, obsoleted: 4 , message: " Use addingReportingOverflow(_:) instead. " )
3611
- @inlinable
3612
- public static func addWithOverflow(
3613
- _ lhs: Self , _ rhs: Self
3614
- ) -> ( Self , overflow: Bool ) {
3615
- let ( partialValue, overflow) =
3616
- lhs. addingReportingOverflow ( rhs)
3617
- return ( partialValue, overflow: overflow)
3618
- }
3619
-
3620
- @available ( swift, obsoleted: 4 , message: " Use subtractingReportingOverflow(_:) instead. " )
3621
- @inlinable
3622
- public static func subtractWithOverflow(
3623
- _ lhs: Self , _ rhs: Self
3624
- ) -> ( Self , overflow: Bool ) {
3625
- let ( partialValue, overflow) =
3626
- lhs. subtractingReportingOverflow ( rhs)
3627
- return ( partialValue, overflow: overflow)
3628
- }
3629
-
3630
- @inlinable
3631
- @available ( swift, obsoleted: 4 , message: " Use multipliedReportingOverflow(by:) instead. " )
3632
- public static func multiplyWithOverflow(
3633
- _ lhs: Self , _ rhs: Self
3634
- ) -> ( Self , overflow: Bool ) {
3635
- let ( partialValue, overflow) =
3636
- lhs. multipliedReportingOverflow ( by: rhs)
3637
- return ( partialValue, overflow: overflow)
3638
- }
3639
-
3640
- @inlinable
3641
- @available ( swift, obsoleted: 4 , message: " Use dividedReportingOverflow(by:) instead. " )
3642
- public static func divideWithOverflow(
3643
- _ lhs: Self , _ rhs: Self
3644
- ) -> ( Self , overflow: Bool ) {
3645
- let ( partialValue, overflow) =
3646
- lhs. dividedReportingOverflow ( by: rhs)
3647
- return ( partialValue, overflow: overflow)
3648
- }
3649
-
3650
- @inlinable
3651
- @available ( swift, obsoleted: 4 , message: " Use remainderReportingOverflow(dividingBy:) instead. " )
3652
- public static func remainderWithOverflow(
3653
- _ lhs: Self , _ rhs: Self
3654
- ) -> ( Self , overflow: Bool ) {
3655
- let ( partialValue, overflow) =
3656
- lhs. remainderReportingOverflow ( dividingBy: rhs)
3657
- return ( partialValue, overflow: overflow)
3658
- }
3659
- }
3660
-
3661
- extension BinaryInteger {
3662
- @inlinable
3663
- @available ( swift, obsoleted: 3.2 ,
3664
- message: " Please use FixedWidthInteger protocol as a generic constraint and addingReportingOverflow(_:) method instead. " )
3665
- public static func addWithOverflow(
3666
- _ lhs: Self , _ rhs: Self
3667
- ) -> ( Self , overflow: Bool ) {
3668
- fatalError ( " Unavailable " )
3669
- }
3670
-
3671
- @inlinable
3672
- @available ( swift, obsoleted: 3.2 ,
3673
- message: " Please use FixedWidthInteger protocol as a generic constraint and subtractingReportingOverflow(_:) method instead. " )
3674
- public static func subtractWithOverflow(
3675
- _ lhs: Self , _ rhs: Self
3676
- ) -> ( Self , overflow: Bool ) {
3677
- fatalError ( " Unavailable " )
3678
- }
3679
-
3680
- @inlinable
3681
- @available ( swift, obsoleted: 3.2 ,
3682
- message: " Please use FixedWidthInteger protocol as a generic constraint and multipliedReportingOverflow(by:) method instead. " )
3683
- public static func multiplyWithOverflow(
3684
- _ lhs: Self , _ rhs: Self
3685
- ) -> ( Self , overflow: Bool ) {
3686
- fatalError ( " Unavailable " )
3687
- }
3688
-
3689
- @inlinable
3690
- @available ( swift, obsoleted: 3.2 ,
3691
- message: " Please use FixedWidthInteger protocol as a generic constraint and dividedReportingOverflow(by:) method instead. " )
3692
- public static func divideWithOverflow(
3693
- _ lhs: Self , _ rhs: Self
3694
- ) -> ( Self , overflow: Bool ) {
3695
- fatalError ( " Unavailable " )
3696
- }
3697
-
3698
- @inlinable
3699
- @available ( swift, obsoleted: 3.2 ,
3700
- message: " Please use FixedWidthInteger protocol as a generic constraint and remainderReportingOverflow(dividingBy:) method instead. " )
3701
- public static func remainderWithOverflow(
3702
- _ lhs: Self , _ rhs: Self
3703
- ) -> ( Self , overflow: Bool ) {
3704
- fatalError ( " Unavailable " )
3705
- }
3706
- }
3707
-
3708
3569
// FIXME(integers): Absence of &+ causes ambiguity in the code like the
3709
3570
// following:
3710
3571
// func f<T : SignedInteger>(_ x: T, _ y: T) {
@@ -3720,24 +3581,10 @@ extension SignedInteger {
3720
3581
fatalError ( " Should be overridden in a more specific type " )
3721
3582
}
3722
3583
3723
- @_transparent
3724
- @available ( swift, obsoleted: 4.0 ,
3725
- message: " Please use 'FixedWidthInteger' instead of 'SignedInteger' to get '&+' in generic code. " )
3726
- public static func &+ ( lhs: Self , rhs: Self ) -> Self {
3727
- return _maskingAdd ( lhs, rhs)
3728
- }
3729
-
3730
3584
@_transparent
3731
3585
public static func _maskingSubtract( _ lhs: Self , _ rhs: Self ) -> Self {
3732
3586
fatalError ( " Should be overridden in a more specific type " )
3733
3587
}
3734
-
3735
- @_transparent
3736
- @available ( swift, obsoleted: 4.0 ,
3737
- message: " Please use 'FixedWidthInteger' instead of 'SignedInteger' to get '&-' in generic code. " )
3738
- public static func &- ( lhs: Self , rhs: Self ) -> Self {
3739
- return _maskingSubtract ( lhs, rhs)
3740
- }
3741
3588
}
3742
3589
3743
3590
extension SignedInteger where Self : FixedWidthInteger {
0 commit comments