Skip to content

Commit 15e52d5

Browse files
authored
Merge pull request #1423 from tshortli/emit-module-experimental-lazy-typecheck
Pass -experimental-lazy-typecheck to -emit-module jobs
2 parents e5b7226 + e0dd9a8 commit 15e52d5

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

Sources/SwiftDriver/Driver/Driver.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2092,8 +2092,8 @@ extension Driver {
20922092
case .indexFile:
20932093
compilerOutputType = .indexData
20942094

2095-
case .parse, .resolveImports, .typecheck, .dumpParse,
2096-
.printAst, .dumpTypeRefinementContexts, .dumpScopeMaps,
2095+
case .parse, .resolveImports, .typecheck, .experimentalLazyTypecheck,
2096+
.dumpParse, .printAst, .dumpTypeRefinementContexts, .dumpScopeMaps,
20972097
.dumpInterfaceHash, .dumpTypeInfo, .verifyDebugInfo:
20982098
compilerOutputType = nil
20992099

Sources/SwiftDriver/Jobs/EmitModuleJob.swift

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ extension Driver {
106106
try commandLine.appendLast(.emitExtensionBlockSymbols, .omitExtensionBlockSymbols, from: &parsedOptions)
107107
try commandLine.appendLast(.symbolGraphMinimumAccessLevel, from: &parsedOptions)
108108
try commandLine.appendLast(.checkApiAvailabilityOnly, from: &parsedOptions)
109+
if isFrontendArgSupported(.experimentalLazyTypecheck) {
110+
try commandLine.appendLast(.experimentalLazyTypecheck, from: &parsedOptions)
111+
}
109112

110113
if parsedOptions.hasArgument(.parseAsLibrary, .emitLibrary) {
111114
commandLine.appendFlag(.parseAsLibrary)

Sources/SwiftOptions/Option.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public struct Option {
5959
/// The spelling of the option, including any leading dashes.
6060
public let spelling: String
6161

62-
///. The kind of option, which determines how it is parsed.
62+
/// The kind of option, which determines how it is parsed.
6363
public let kind: Kind
6464

6565
/// The option that this aliases, if any, as a closure that produces the

Sources/SwiftOptions/Options.swift

+1
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,7 @@ extension Option {
12391239
Option.ExperimentalPerformanceAnnotations,
12401240
Option.platformCCallingConventionEQ,
12411241
Option.platformCCallingConvention,
1242+
Option.experimentalLazyTypecheck,
12421243
Option.experimentalPrintFullConvention,
12431244
Option.experimentalSkipAllFunctionBodies,
12441245
Option.experimentalSkipNonInlinableFunctionBodiesWithoutTypes,

Tests/SwiftDriverTests/SwiftDriverTests.swift

+12
Original file line numberDiff line numberDiff line change
@@ -7227,6 +7227,18 @@ final class SwiftDriverTests: XCTestCase {
72277227
]))
72287228
}
72297229
}
7230+
7231+
func testEmitModuleExperimentalLazyTypecheck() throws {
7232+
var driver = try Driver(args: [
7233+
"swiftc", "test.swift", "-module-name", "Test", "-experimental-lazy-typecheck", "-emit-module-interface"
7234+
])
7235+
guard driver.isFrontendArgSupported(.experimentalLazyTypecheck) else {
7236+
throw XCTSkip("Skipping: compiler does not support '-experimental-lazy-typecheck'")
7237+
}
7238+
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
7239+
let emitModuleJob = try XCTUnwrap(jobs.first(where: {$0.kind == .emitModule}))
7240+
XCTAssertTrue(emitModuleJob.commandLine.contains(.flag("-experimental-lazy-typecheck")))
7241+
}
72307242
}
72317243

72327244
func assertString(

0 commit comments

Comments
 (0)