Skip to content

Commit 11246be

Browse files
committed
Add explicit init from BinaryInteger to CGFloat
The override was previously missing, which meant that we fell back on the generic implementation; we should simply forward this to the NativeType implementation instead.
1 parent 4f27eee commit 11246be

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stdlib/public/Darwin/CoreGraphics/CGFloat.swift.gyb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ public struct CGFloat {
6161
}
6262

6363
extension CGFloat : SignedNumeric {
64+
@_alwaysEmitIntoClient // availability
65+
public init<T: BinaryInteger>(_ source: T) {
66+
self.native = NativeType(source)
67+
}
6468

6569
@_transparent
66-
public init?<T : BinaryInteger>(exactly source: T) {
70+
public init?<T: BinaryInteger>(exactly source: T) {
6771
guard let native = NativeType(exactly: source) else { return nil }
6872
self.native = native
6973
}
@@ -72,7 +76,6 @@ extension CGFloat : SignedNumeric {
7276
public var magnitude: CGFloat {
7377
return CGFloat(native.magnitude)
7478
}
75-
7679
}
7780

7881
extension CGFloat : BinaryFloatingPoint {

0 commit comments

Comments
 (0)