File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ extension OptionTable {
153153 throw OptionParseError . unknownOption (
154154 index: index - 1 , argument: argument)
155155 }
156- parsedOptions. addOption ( . DASHDASH, argument: . single ( " -- " ) )
156+ parsedOptions. addOption ( . DASHDASH, argument: . multiple ( Array ( ) ) )
157157 arguments [ index... ] . map { String ( $0) } . forEach { parsedOptions. addInput ( $0) }
158158 index = arguments. endIndex
159159
Original file line number Diff line number Diff line change @@ -75,7 +75,11 @@ extension ParsedOption: CustomStringConvertible {
7575 return option. spelling + " " + argument. asSingle. spm_shellEscaped ( )
7676
7777 case . remaining:
78- return argument. asSingle
78+ let args = argument. asMultiple
79+ if args. isEmpty {
80+ return option. spelling
81+ }
82+ return option. spelling + " " + argument. asMultiple. map { $0. spm_shellEscaped ( ) } . joined ( separator: " " )
7983 }
8084 }
8185}
Original file line number Diff line number Diff line change @@ -2937,6 +2937,18 @@ final class SwiftDriverTests: XCTestCase {
29372937 }
29382938 }
29392939
2940+ func testDashDashImmediateInput( ) throws {
2941+ do {
2942+ var driver = try Driver ( args: [ " swift " , " -- " , " main.swift " ] )
2943+ let plannedJobs = try driver. planBuild ( ) . removingAutolinkExtractJobs ( )
2944+ XCTAssertFalse ( driver. diagnosticEngine. hasErrors)
2945+ XCTAssertEqual ( plannedJobs. count, 1 )
2946+ XCTAssertEqual ( plannedJobs [ 0 ] . kind, . interpret)
2947+ XCTAssertEqual ( plannedJobs [ 0 ] . inputs. count, 1 )
2948+ XCTAssertEqual ( plannedJobs [ 0 ] . inputs [ 0 ] . file, VirtualPath . relative ( RelativePath ( " main.swift " ) ) )
2949+ }
2950+ }
2951+
29402952 func testWholeModuleOptimizationOutputFileMap( ) throws {
29412953 let contents = """
29422954 {
You can’t perform that action at this time.
0 commit comments