Skip to content
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

Tests on Linux and macOS (#60) #63

Merged
merged 5 commits into from
Aug 19, 2023
Merged

Tests on Linux and macOS (#60) #63

merged 5 commits into from
Aug 19, 2023

Conversation

oscbyspro
Copy link
Owner

Somebody, please uninvent semantically significant indentation.

@oscbyspro
Copy link
Owner Author

oscbyspro commented Aug 19, 2023

Hm. I wonder why it fails on the Swift 5.7 image but not on 5.8:

.../NBKDoubleWidth.swift:256:1: error: expected declaration
#endif
^
254) #if SBI && swift(>=5.8)
255) @available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
256) #endif
257) public typealias Int128 = NBKDoubleWidth<NBKDoubleWidth<Int>>

Edit: I get the same error on Xcode 14.2. That's something at least.

@oscbyspro
Copy link
Owner Author

oscbyspro commented Aug 19, 2023

Is this a Swift 5.7 bug? Here's the surrounding context:

#if arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32) || arch(powerpc)

/// A signed, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
#endif // 🚨
public typealias Int128 = NBKDoubleWidth<NBKDoubleWidth<Int>>

/// An unsigned, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
#endif // 🚨
public typealias UInt128 = NBKDoubleWidth<NBKDoubleWidth<UInt>>

#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)

/// A signed, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
#endif // ✅
public typealias Int128 = NBKDoubleWidth<Int>

/// An unsigned, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
#endif // ✅
public typealias UInt128 = NBKDoubleWidth<UInt>

#else

#error("NBKDoubleWidth can only be used on a 32-bit or 64-bit platform.")

#endif

@oscbyspro
Copy link
Owner Author

oscbyspro commented Aug 19, 2023

It compiles if I make the following (silly) change:

#if arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32) || arch(powerpc)

/// A signed, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
public typealias Int128 = NBKDoubleWidth<NBKDoubleWidth<Int>>
#else  // because Swift 5.7 cannot parse it otherwise
public typealias Int128 = NBKDoubleWidth<NBKDoubleWidth<Int>>
#endif // ✅

/// An unsigned, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
public typealias UInt128 = NBKDoubleWidth<NBKDoubleWidth<UInt>>
#else  // because Swift 5.7 cannot parse it otherwise
public typealias UInt128 = NBKDoubleWidth<NBKDoubleWidth<UInt>>
#endif // ✅

#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)

/// A signed, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
#endif // ✅
public typealias Int128 = NBKDoubleWidth<Int>

/// An unsigned, 128-bit, integer.
#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
#endif // ✅
public typealias UInt128 = NBKDoubleWidth<UInt>

#else

#error("NBKDoubleWidth can only be used on a 32-bit or 64-bit platform.")

#endif

@oscbyspro oscbyspro changed the title Tests on Linux (#60). Tests on Linux (#60) Aug 19, 2023
@oscbyspro
Copy link
Owner Author

It works on Xcode 14.2 now, but the Linux tests still fail.

@oscbyspro
Copy link
Owner Author

oscbyspro commented Aug 19, 2023

So removing the availability annotations is fine. I feel like I tried this exact thing yesterday and it did not work for whatever reason. I need a vaction. Maybe I also need to try an older OS version? Like macOS 12 or whatnot?

@oscbyspro oscbyspro changed the title Tests on Linux (#60) Tests on Linux and macOS (#60) Aug 19, 2023
@oscbyspro
Copy link
Owner Author

oscbyspro commented Aug 19, 2023

Just to be clear, the current code works if you set withStaticBitInt to true, but not if you pass SBI on the command line. This is because SBI does not update the platform requirements in Package.swift, like withStaticBigInt does.

@oscbyspro
Copy link
Owner Author

I had a great I idea involving a custom _ExpressibleByBuiltinIntegerLiteral conformance, but no dice :(

@oscbyspro oscbyspro merged commit 2e74e5c into main Aug 19, 2023
@oscbyspro oscbyspro deleted the feature/workflows branch August 19, 2023 11:20
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.

1 participant