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-16113] Misplacing a Spacer() before ToolbarItemGroup results into compiler error: Failed to produce diagnostic for expression; #58372

Open
wally4u opened this issue Apr 10, 2022 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression SwiftUI Flag: Related to (but not an issue with) SwiftUI type checker Area → compiler: Semantic analysis

Comments

@wally4u
Copy link

wally4u commented Apr 10, 2022

Previous ID SR-16113
Radar None
Original Reporter @wally4u
Type Bug
Environment

Xcode Version 13.3 (13E113)

Target iOS 15.4

MBP 16" 2022

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

md5: e96a77cac753636c32501dddacb4e816

Issue Description:

The following SwiftUI Code will generate the following error:

Failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project

While the code is incorrect, Spacer() should be placed within the ToolbarItemGroup, a non descriptive error is generated.

Code snippet

import SwiftUI

struct ContentView: View {
    @State var myFruit: String = ""    

var body: some View {
        NavigationView {
            Form {
                Section {
                    Text(myFruit)
                    TextField("Fruit", text: $myFruit)
                }
            }
            .toolbar {
                Spacer()   // should be inside ToolbarGroup
                ToolbarItemGroup(placement: .keyboard) {
//                    Spacer() // Correct location
                    Button("Spacer") {
                    }                }
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Note: Cannot upload project due to Jira error:
"An internal error has occurred. Please contact your administrator."

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@grynspan grynspan added the SwiftUI Flag: Related to (but not an issue with) SwiftUI label May 6, 2022
@AnthonyLatsis AnthonyLatsis added the type checker Area → compiler: Semantic analysis label Nov 4, 2022
@AnthonyLatsis AnthonyLatsis added diagnostics QoI Bug: Diagnostics Quality of Implementation failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression labels Dec 22, 2022
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 diagnostics QoI Bug: Diagnostics Quality of Implementation failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression SwiftUI Flag: Related to (but not an issue with) SwiftUI type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants