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

#available and #unavailable cannot be in the same statement #3985

Closed
2 tasks done
Cyberbeni opened this issue May 30, 2022 · 0 comments · Fixed by #4002
Closed
2 tasks done

#available and #unavailable cannot be in the same statement #3985

Cyberbeni opened this issue May 30, 2022 · 0 comments · Fixed by #4002
Labels
bug Unexpected and reproducible misbehavior.

Comments

@Cyberbeni
Copy link
Contributor

New Issue Checklist

Describe the bug

The following triggers the unavailable_condition warning but when using the recommended code, it gives compiler error

if #available(macOS 11.0, *) {
   // Do nothing
} else if #available(macOS 10.15, *) {
   print("do some stuff")
}
if #unavailable(macOS 11.0, *),  #available(macOS 10.15, *) { // #available and #unavailable cannot be in the same statement
   print("do some stuff")
}
Complete output when running SwiftLint, including the stack trace and command used

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.47.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
  • Paste your configuration file: -
  • Are you using nested configurations? No
  • Which Xcode version are you using (check xcodebuild -version)? Xcode 13.4 Build version 13F17a
  • Do you have a sample that shows the issue? In the Describe the bug section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
2 participants