Remove redundant conformances

This commit is contained in:
Xiaodi Wu 2018-02-09 22:46:18 -06:00
parent c5816a93c5
commit ac4c3c6018
3 changed files with 8 additions and 13 deletions

View File

@ -201,9 +201,7 @@ extension BinaryInteger where Magnitude : UnsignedInteger {
// is necessary to disambiguate calls to `Magnitude.lcmReportingOverflow(_:_:)`
// and `Magnitude.lcmFullWidth(_:_:)`.
extension BinaryInteger
where Self : FixedWidthInteger,
Magnitude : FixedWidthInteger & UnsignedInteger,
Magnitude.Magnitude == Magnitude {
where Self : FixedWidthInteger, Magnitude : UnsignedInteger {
// ---------------------------------------------------------------------------
// MARK: Factoring (Fixed-Width)
// ---------------------------------------------------------------------------

View File

@ -51,9 +51,7 @@ import Security
/// numeric value is `uniform()`; that method is overloaded to permit custom
/// minimum and maximum values for the uniform distribution.
public protocol PRNG : class, IteratorProtocol, Sequence
where Element : FixedWidthInteger & UnsignedInteger,
SubSequence : Sequence,
Element == SubSequence.Element {
where Element : FixedWidthInteger & UnsignedInteger {
/// A type that can represent the internal state of the pseudo-random number
/// generator.
associatedtype State
@ -247,7 +245,7 @@ extension PRNG {
/// through `b` (inclusive) from the discrete uniform distribution.
public func uniform<T : FixedWidthInteger & SignedInteger>(
_: T.Type = T.self, a: T, b: T
) -> T where T.Magnitude : FixedWidthInteger & UnsignedInteger {
) -> T where T.Magnitude : UnsignedInteger {
precondition(
b >= a,
"Discrete uniform distribution parameter b should not be less than a"
@ -275,7 +273,7 @@ extension PRNG {
@_transparent // @_inlineable
public func uniform<T : FixedWidthInteger & SignedInteger>(
_: T.Type = T.self
) -> T where T.Magnitude : FixedWidthInteger & UnsignedInteger {
) -> T where T.Magnitude : UnsignedInteger {
return uniform(a: T.min, b: T.max)
}
@ -286,7 +284,7 @@ extension PRNG {
public func uniform<T : FixedWidthInteger & SignedInteger>(
_: T.Type = T.self, a: T, b: T, count: Int
) -> UnfoldSequence<T, Int>
where T.Magnitude : FixedWidthInteger & UnsignedInteger {
where T.Magnitude : UnsignedInteger {
precondition(count >= 0, "Element count should be non-negative")
return sequence(state: 0) { (state: inout Int) -> T? in
state += 1
@ -301,7 +299,7 @@ extension PRNG {
public func uniform<T : FixedWidthInteger & SignedInteger>(
_: T.Type = T.self, count: Int
) -> UnfoldSequence<T, Int>
where T.Magnitude : FixedWidthInteger & UnsignedInteger {
where T.Magnitude : UnsignedInteger {
return uniform(a: T.min, b: T.max, count: count)
}
}

View File

@ -70,8 +70,7 @@
@_fixed_layout
public struct Rational<T : SignedInteger> : Codable
where T : Codable & _ExpressibleByBuiltinIntegerLiteral,
T.Magnitude : UnsignedInteger,
T.Magnitude.Magnitude == T.Magnitude {
T.Magnitude : UnsignedInteger {
// ---------------------------------------------------------------------------
// MARK: Stored Properties
// ---------------------------------------------------------------------------
@ -163,7 +162,7 @@ where T : Codable & _ExpressibleByBuiltinIntegerLiteral,
}
}
extension Rational where T : FixedWidthInteger, T.Magnitude : FixedWidthInteger {
extension Rational where T : FixedWidthInteger {
// ---------------------------------------------------------------------------
// MARK: Initializers (Constrained)
// ---------------------------------------------------------------------------