Skip to content

Commit cf65b8f

Browse files
committed
Disable typo-correction by default until we can make it work within acceptable performance bounds
Typo-correction can be so expensive that it can slow down typechecking over 10x. It can be a significant productivity drain for developing on large projects. Unfortunately it is best that we disable it until we can dedicate the time to address its performance issues and we are certain it works within acceptable performance bounds. rdar://51966070
1 parent 747c69c commit cf65b8f

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ namespace swift {
8888
bool DisableAvailabilityChecking = false;
8989

9090
/// Maximum number of typo corrections we are allowed to perform.
91-
unsigned TypoCorrectionLimit = 10;
91+
/// This is disabled by default until we can get typo-correction working within acceptable performance bounds.
92+
unsigned TypoCorrectionLimit = 0;
9293

9394
/// Should access control be respected?
9495
bool EnableAccessControl = true;

test/SourceKit/Sema/sema_symlink.swift.response

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,13 @@
1212
key.column: 16,
1313
key.filepath: real.swift,
1414
key.severity: source.diagnostic.severity.error,
15-
key.description: "use of unresolved identifier 'goo'; did you mean 'Bool'?",
15+
key.description: "use of unresolved identifier 'goo'",
1616
key.diagnostic_stage: source.diagnostic.stage.swift.sema,
1717
key.ranges: [
1818
{
1919
key.offset: 15,
2020
key.length: 3
2121
}
22-
],
23-
key.fixits: [
24-
{
25-
key.offset: 15,
26-
key.length: 3,
27-
key.sourcetext: "Bool"
28-
}
29-
],
30-
key.diagnostics: [
31-
{
32-
key.line: 1,
33-
key.column: 16,
34-
key.filepath: real.swift,
35-
key.severity: source.diagnostic.severity.note,
36-
key.description: "'Bool' declared here (Swift.Bool)"
37-
}
3822
]
3923
}
4024
]

test/lit.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,10 @@ else:
11751175
lit_config.fatal("Don't know how to define target_run and "
11761176
"target_build_swift for platform " + config.variant_triple)
11771177

1178+
# Enable typo-correction for testing purposes.
1179+
config.target_swift_frontend += " -typo-correction-limit 10 "
1180+
subst_target_swift_frontend_mock_sdk += " -typo-correction-limit 10 "
1181+
11781182
config.substitutions.append(('%module-target-triple',
11791183
target_specific_module_triple))
11801184

0 commit comments

Comments
 (0)