-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
With the Swift ArgumentParser project:
cmake -D BUILD_EXAMPLES=NO -D BUILD_TESTING=NO -G Ninja -S . -B .ninja-build && cmake --build .ninja-build
works fine, but
cmake -D BUILD_EXAMPLES=NO -D BUILD_TESTING=NO -G Xcode -S . -B .xcode-build && cmake --build .xcode-build
fails with:
/Users/dave/src/swift-project/swift-argument-parser/Sources/ArgumentParser/Parsing/CommandParser.swift:289:101: error: value of optional type 'GenerateCompletions?' must be unwrapped to refer to member 'generateCompletionScript' of wrapped base type 'GenerateCompletions'
throw CommandError(commandStack: commandStack, parserError: .completionScriptRequested(shell: result.generateCompletionScript))
^
/Users/dave/src/swift-project/swift-argument-parser/Sources/ArgumentParser/Parsing/CommandParser.swift:289:101: note: chain the optional using '?' to access member 'generateCompletionScript' only for non-'nil' base values
throw CommandError(commandStack: commandStack, parserError: .completionScriptRequested(shell: result.generateCompletionScript))
^
?
/Users/dave/src/swift-project/swift-argument-parser/Sources/ArgumentParser/Parsing/CommandParser.swift:295:8: error: value of optional type 'AutodetectedGenerateCompletions?' must be unwrapped to refer to member 'generateCompletionScript' of wrapped base type 'AutodetectedGenerateCompletions'
result.generateCompletionScript
^
/Users/dave/src/swift-project/swift-argument-parser/Sources/ArgumentParser/Parsing/CommandParser.swift:295:8: note: chain the optional using '?' to access member 'generateCompletionScript' only for non-'nil' base values
result.generateCompletionScript
^
?
/Users/dave/src/swift-project/swift-argument-parser/Sources/ArgumentParser/Parsing/CommandParser.swift:295:8: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
result.generateCompletionScript
^
!
The types are actually deduced differently. You can see the different types if you open the generated Xcode project and the SPM project with Xcode.
Reproduction
See above.
Expected behavior
The xcode build works; the types are deduced the same.
Environment
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
Additional information
No response
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels