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

[SR-13436] #warning() doesn't compile at some source location #55877

Closed
mattyoung opened this issue Aug 24, 2020 · 2 comments
Closed

[SR-13436] #warning() doesn't compile at some source location #55877

mattyoung opened this issue Aug 24, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@mattyoung
Copy link

Previous ID SR-13436
Radar rdar://problem/67656247
Original Reporter @mattyoung
Type Bug
Status Resolved
Resolution Won't Do
Environment

Xcode 12 beta 5

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: c6d5bdb20609211fc2dcc36313ec96cb

Issue Description:

import SwiftUI

struct BugHereSomewhere: View {
    var body: some View {
        #warning("#warning here is allowed")
        VStack {
            Text("Hello")
        }
        #warning("#warning here is not allowed!")
        .ignoresSafeArea()
    }
}

I think it should be allowed anywhere comment is allow. See https://forums.swift.org/t/why-warning-not-allowed-in-some-source-location/39643

@typesanitizer
Copy link

@swift-ci create

@DougGregor
Copy link
Member

Swift (intentionally) doesn't have the C-preprocessor-like behavior of letting # directives go anywhere: #warning is a declaration, so it cannot be in the middle of a postfix-expression chain.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants