Skip to content

Fix NSRect init invocation on 32bit platforms #2226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2019

Conversation

uraimo
Copy link
Contributor

@uraimo uraimo commented May 8, 2019

This fixes an issue in NSGeometry on 32bit platforms selecting the (x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat) overload, that will just cast a CGFloat::NativeType to, again, a CGFloat::NativeType, platform dependent (either Float or Double).

The error I'm getting right now:

/mnt/buildSwiftOnARM/swift-corelibs-foundation/Foundation/NSGeometry.swift:689:12: error: cannot invoke initializer for type 'NSRect' with an argument list of type '(x: Float, y: Float, width: Float, height: Float)'
    return NSRect(x: x, y: y, width: w, height: h)
           ^
/mnt/buildSwiftOnARM/swift-corelibs-foundation/Foundation/NSGeometry.swift:689:12: note: overloads for 'NSRect' exist with these partially matching parameter lists: (x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat), (x: Double, y: Double, width: Double, height: Double), (x: Int, y: Int, width: Int, height: Int)
    return NSRect(x: x, y: y, width: w, height: h)
           ^
ninja: build stopped: subcommand failed.
./swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

CGFloat's init will maintain the correct NativeType for the current platform type.
@compnerd
Copy link
Member

compnerd commented May 8, 2019

@swift-ci please test

@compnerd
Copy link
Member

compnerd commented May 8, 2019

@millenomi - okay with you? I believe that this is correct.

@millenomi millenomi merged commit 9971110 into swiftlang:master May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants