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

Conditionally compiled availability annotations? #64

Open
oscbyspro opened this issue Aug 19, 2023 · 3 comments
Open

Conditionally compiled availability annotations? #64

oscbyspro opened this issue Aug 19, 2023 · 3 comments
Labels
await can't be done yet

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented Aug 19, 2023

I tried to set up a GitHub workflow with tests on Linux (#60) (#63), but I discovered that the Swift 5.7 compiler is broken. In particular, it cannot parse the following in some situations. It works on Swift 5.8, and on Xcode 14.2 after I pushed a hot-fix, but it still fails on Swift 5.7 using Linux.

#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
#endif

The supposed problem is that @available expects a declaration, which is provided below #endif.


Edit: It seems like this is a Swift 5.8 feature (SE-0367). If so, then why does it compile on Xcode 14.2?

@oscbyspro oscbyspro added the bug please fix this :( label Aug 19, 2023
@oscbyspro oscbyspro changed the title Swift 5.7 compiler bug: conditionally compiled availability annotation. Swift 5.7 compiler bug: conditionally compiled availability annotation Aug 19, 2023
@oscbyspro oscbyspro removed the bug please fix this :( label Aug 19, 2023
@oscbyspro oscbyspro changed the title Swift 5.7 compiler bug: conditionally compiled availability annotation Conditionally compiled availability annotation? (>=5.8) Aug 19, 2023
@oscbyspro oscbyspro closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2023
@oscbyspro oscbyspro reopened this Aug 19, 2023
@oscbyspro oscbyspro changed the title Conditionally compiled availability annotation? (>=5.8) Conditionally compiled availability annotation? Aug 19, 2023
@oscbyspro oscbyspro added the await can't be done yet label Aug 19, 2023
@oscbyspro oscbyspro changed the title Conditionally compiled availability annotation? Conditionally compiled availability annotations? Aug 19, 2023
@ypopovych
Copy link
Contributor

You can try it like this:

#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
extension NBKDoubleWidth {
#else
extension NBKDoubleWidth {
#endif

@oscbyspro
Copy link
Owner Author

Sadly extension NBKDoubleWidth { does not count as a declaration:

#if SBI && swift(>=5.8)
@available(iOS 16.4, macCatalyst 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4, *)
extension NBKDoubleWidth {
#else
extension NBKDoubleWidth {
#endif // 🛑 Expected '}' at end of extension 🛑 Expected declaration
}      // 🛑 Extraneous '}' at top level

@ypopovych
Copy link
Contributor

Arghhh. They should rewrite the compiler into Swift and redo the parser and macro preprocessor. Too many bugs. When you do a lot of metaprogramming it starts to crash on proper code. Had a couple of type workarounds in my libs because the compiler crashes non-stop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
await can't be done yet
Projects
None yet
Development

No branches or pull requests

2 participants