-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationfailed to produce diagnosticBug → internal error: Failed to produce diagnostic for expressionBug → internal error: Failed to produce diagnostic for expressiongood first issueGood for newcomersGood for newcomersswift 5.9type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Describe the bug
Xcode/Swift/VSCode fail to notice that the variable has not been defined in some contexts.
Steps To Reproduce
- Attempt to use an undefined variable in the following context where the name is also a keyword.
- See following code that fails to compile and fails to provide a useful reason why.
Expected behavior
A notice that the variable was not defined rather than "failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project sourcekitd".
Or, a notice that the use of 'open' is incorrect as it's a keyword.
Screenshots
N/A
Environment (please fill out the following information)
- OS: macOS 13 beta 7
- Xcode Version/Tag/Branch: 14.0 RC or VS Code 1.71.0 with Swift extension 0.8.1
import SwiftUI
struct MyView: View {
// var open = true
var body: some View {
Button {
// no action
} label: {
Image(systemName: "plus")
.rotationEffect(.degrees(open ? 45 : 0)) // Using keyword 'open'
}
}
}
Additional context
Placing the 'open ? 45 : 0' inside of another context, say a print(), correctly identifies the issue of an undefined variable.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationfailed to produce diagnosticBug → internal error: Failed to produce diagnostic for expressionBug → internal error: Failed to produce diagnostic for expressiongood first issueGood for newcomersGood for newcomersswift 5.9type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis