Skip to content

Commit 2737f31

Browse files
authored
Merge pull request #2 from apple/master
Diagnose -i arg (#14)
2 parents ae19235 + 9c7b8cc commit 2737f31

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,7 @@ extension Driver {
688688
compilerOutputType = nil
689689

690690
case .i:
691-
// FIXME: diagnose this
692-
break
691+
diagnosticsEngine.emit(.error_i_mode(driverKind))
693692

694693
case .repl, .deprecatedIntegratedRepl, .lldbRepl:
695694
compilerOutputType = nil
@@ -707,6 +706,17 @@ extension Driver {
707706
}
708707
}
709708

709+
extension Diagnostic.Message {
710+
public static func error_i_mode(_ driverKind: DriverKind) -> Diagnostic.Message {
711+
.error(
712+
"""
713+
the flag '-i' is no longer required and has been removed; \
714+
use '\(driverKind.usage) input-filename'
715+
"""
716+
)
717+
}
718+
}
719+
710720
// Multithreading
711721
extension Driver {
712722
/// Determine the number of threads to use for a multithreaded build,

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ final class SwiftDriverTests: XCTestCase {
142142
XCTAssertEqual(driver3.linkerOutputType, .staticLibrary)
143143
}
144144

145+
func testPrimaryOutputKindsDiagnostics() throws {
146+
try assertDriverDiagnostics(args: "swift", "-i") {
147+
$1.expect(.error_i_mode(.interactive))
148+
}
149+
}
150+
145151
func testDebugSettings() throws {
146152
try assertNoDriverDiagnostics(args: "swiftc", "foo.swift", "-emit-module") { driver in
147153
XCTAssertNil(driver.debugInfoLevel)

0 commit comments

Comments
 (0)