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-15767] Failed to produce diagnostic for expression #58044

Open
swift-ci opened this issue Jan 23, 2022 · 0 comments
Open

[SR-15767] Failed to produce diagnostic for expression #58044

swift-ci opened this issue Jan 23, 2022 · 0 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Jan 23, 2022

Previous ID SR-15767
Radar None
Original Reporter AndyKlien (JIRA User)
Type Bug
Environment

I was working on a project and received this bug message while trying to compile the file.

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

md5: 5c2bf1b01490da1eca82ab49c5eb3287

Issue Description:

I was working on a project and received this bug message while trying to compile the file.

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

//

// ContentView.swift

// M29A2

//

// Created by Andy Klien on 2022-01-23.

//

import SwiftUI

struct ContentView: View {

@State **var** userText = ""

@State **var** capMode = 1



**var** body: **some** View {

    

    VStack{

        

        **if** capMode == 1

{ Text(userText.uppercased()) .font(.largeTitle) }

else if capMode == 2

{ Text(userText.capitalized()) .font(.largeTitle) }

else if capMode == 3

{ Text(userText.lowercased()) .font(.largeTitle) }

        Text(userText)

            .font(.largeTitle)

            .foregroundColor(.blue)

            .bold()

            .padding()

        

        TextField("Enter Text Here...", text: $userText)

            .padding()

            .background(.gray)

            .cornerRadius(50)

        

        HStack{

            Button(action:

{ capMode = 1 }

) {

                RoundedButton(title: "Caps", colour: .blue)

                

                Button(action:

{ capMode = 2 }

) {

                    RoundedButton(title: "First Letter", colour: .green)

                    

                    Button(action:

{ capMode = 3 }

)

{ RoundedButton(title: "Lowercase", colour: .red) }

                }

            }

            .padding()

        }

    }

}





**struct** RoundedButton: View{

    

    **var** title: String

    **var** colour: Color

    

    **var** body: **some** View

{ Text(title) .padding(10) .frame(maxWidth:.infinity) .background(colour) .font(.body) .cornerRadius(10) .foregroundColor(.white) }

}



**struct** ContentView_Previews: PreviewProvider {

    **static** **var** previews: **some** View

{ ContentView() }

}

}

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant