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

Conditional compilation results in the code passing the check for missing executable statement #73669

Open
CrazyFanFan opened this issue May 16, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@CrazyFanFan
Copy link
Contributor

Description

Conditional compilation results in the code passing the check for missing executable statement. However, it can not pass module verify.

Reproduction

enum Foo: CaseIterable {
    case fooA
    case fooB
}

if let foo = Foo.allCases.randomElement() {
    switch foo {
    case .fooA:
        print("A")
    case .fooB:
        #if DEBUG
        print("B")
        #endif
    }
}

Expected behavior

Failed to compile under release config.

Environment

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

Additional information

No response

@CrazyFanFan CrazyFanFan added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant