Skip to content

Commit 6571472

Browse files
author
ematejska
authored
Merge pull request #3245 from rjmccall/disable-typo-correction
Disable typo-correction in 3.0 preview 2
2 parents 7fed662 + 65ba3ac commit 6571472

17 files changed

+30
-36
lines changed

lib/Sema/TypeCheckNameLookup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,8 @@ void TypeChecker::performTypoCorrection(DeclContext *DC, DeclRefKind refKind,
525525
NameLookupOptions lookupOptions,
526526
LookupResult &result,
527527
unsigned maxResults) {
528+
// Temporarily disable.
529+
#if 0
528530
// Fill in a collection of the most reasonable entries.
529531
TopCollection<unsigned, ValueDecl*> entries(maxResults);
530532
auto consumer = makeDeclConsumer([&](ValueDecl *decl,
@@ -563,6 +565,7 @@ void TypeChecker::performTypoCorrection(DeclContext *DC, DeclRefKind refKind,
563565

564566
for (auto &entry : entries)
565567
result.add({ entry.Value, nullptr });
568+
#endif
566569
}
567570

568571
static InFlightDiagnostic

test/Parse/foreach.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct IntRange<Int> : Sequence, IteratorProtocol {
88
func makeIterator() -> IntRange<Int> { return self }
99
}
1010

11-
func for_each(r: Range<Int>, iir: IntRange<Int>) { // expected-note 2 {{did you mean 'r'?}}
11+
func for_each(r: Range<Int>, iir: IntRange<Int>) {
1212
var sum = 0
1313

1414
// Simple foreach loop, using the variable in the body

test/Parse/implicit_getter_incomplete.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func test1() {
1212

1313
// Would trigger assertion when AST verifier checks source ranges ("child source range not contained within its parent")
1414
func test2() { // expected-note {{match}}
15-
var a : Int { // expected-note {{match}} expected-note {{did you mean 'a'?}}
15+
var a : Int { // expected-note {{match}}
1616
switch i { // expected-error {{unresolved identifier}}
1717
} // expected-error {{'switch' statement body must have at least one}}
1818
// expected-error 2 {{expected '}'}}

test/Parse/invalid.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func test3() {
1717
undeclared_func( // expected-error {{use of unresolved identifier 'undeclared_func'}} expected-note {{to match this opening '('}} expected-error {{expected ',' separator}} {{19-19=,}}
1818
} // expected-error {{expected expression in list of expressions}} expected-error {{expected ')' in expression list}}
1919

20-
func runAction() {} // expected-note {{did you mean 'runAction'?}}
20+
func runAction() {}
2121

2222
// rdar://16601779
2323
func foo() {

test/Parse/recovery.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,9 @@ public enum TestB {
488488
class bar {}
489489
var baz: bar
490490
// expected-error@+1{{unnamed parameters must be written with the empty name '_'}}
491-
func foo1(bar!=baz) {} // expected-note {{did you mean 'foo1'?}}
491+
func foo1(bar!=baz) {}
492492
// expected-error@+1{{unnamed parameters must be written with the empty name '_'}}
493-
func foo2(bar! = baz) {}// expected-note {{did you mean 'foo2'?}}
493+
func foo2(bar! = baz) {}
494494

495495
// rdar://19605567
496496
// expected-error@+1{{use of unresolved identifier 'esp'}}
@@ -524,13 +524,13 @@ func a(s: S[{{g) -> Int {} // expected-note {{to match this opening '('}}
524524
// expected-error@+3{{expected '(' for initializer parameters}}
525525
// expected-error@+2{{initializers may only be declared within a type}}
526526
// expected-error@+1{{expected an identifier to name generic parameter}}
527-
func F() { init<( } )} // expected-note {{did you mean 'F'?}}
527+
func F() { init<( } )}
528528

529529
// rdar://20337695
530530
func f1() {
531531

532532
// expected-error @+6 {{use of unresolved identifier 'C'}}
533-
// expected-note @+5 {{did you mean 'n'?}}
533+
//
534534
// expected-error @+4 {{unary operator cannot be separated from its operand}} {{11-12=}}
535535
// expected-error @+3 {{'==' is not a prefix unary operator}}
536536
// expected-error @+2 {{consecutive statements on a line must be separated by ';'}} {{8-8=;}}

test/Parse/switch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func enumElementSyntaxOnTuple() {
273273

274274
// sr-176
275275
enum Whatever { case Thing }
276-
func f0(values: [Whatever]) { // expected-note {{did you mean 'values'?}}
276+
func f0(values: [Whatever]) {
277277
switch value { // expected-error {{use of unresolved identifier 'value'}}
278278
case .Thing: // Ok. Don't emit diagnostics about enum case not found in type <<error type>>.
279279
break

test/Parse/toplevel_library_invalid.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-parse-verify-swift -parse-as-library
22

3-
let x = 42 // expected-note{{did you mean 'x'?}}
3+
let x = 42
44
x + x; // expected-error {{expressions are not allowed at the top level}} expected-warning {{result of operator '+' is unused}}
55
x + x; // expected-error {{expressions are not allowed at the top level}} expected-warning {{result of operator '+' is unused}}
66
// Make sure we don't crash on closures at the top level

test/Sema/typo_correction.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// This is close enough to get typo-correction.
44
func test_short_and_close() {
5-
let foo = 4 // expected-note {{did you mean 'foo'?}}
5+
let foo = 4
66
let bab = fob + 1 // expected-error {{use of unresolved identifier}}
77
}
88

@@ -18,7 +18,7 @@ func *(x: Whatever, y: Whatever) {}
1818
// This works even for single-character identifiers.
1919
func test_very_short() {
2020
// Note that we don't suggest operators.
21-
let x = 0 // expected-note {{did you mean 'x'?}}
21+
let x = 0
2222
let longer = y // expected-error {{use of unresolved identifier 'y'}}
2323
}
2424

@@ -29,21 +29,21 @@ func test_own_initializer() {
2929

3030
// Report candidates that are the same distance in different ways.
3131
func test_close_matches() {
32-
let match1 = 0 // expected-note {{did you mean 'match1'?}}
33-
let match22 = 0 // expected-note {{did you mean 'match22'?}}
32+
let match1 = 0
33+
let match22 = 0
3434
let x = match2 // expected-error {{use of unresolved identifier 'match2'}}
3535
}
3636

3737
// Report not-as-good matches if they're still close enough to the best.
3838
func test_keep_if_not_too_much_worse() {
39-
let longmatch1 = 0 // expected-note {{did you mean 'longmatch1'?}}
40-
let longmatch22 = 0 // expected-note {{did you mean 'longmatch22'?}}
39+
let longmatch1 = 0
40+
let longmatch22 = 0
4141
let x = longmatch // expected-error {{use of unresolved identifier 'longmatch'}}
4242
}
4343

4444
// Report not-as-good matches if they're still close enough to the best.
4545
func test_drop_if_too_different() {
46-
let longlongmatch1 = 0 // expected-note {{did you mean 'longlongmatch1'?}}
46+
let longlongmatch1 = 0
4747
let longlongmatch2222 = 0
4848
let x = longlongmatch // expected-error {{use of unresolved identifier 'longlongmatch'}}
4949
}
@@ -61,8 +61,8 @@ func test_too_many_same() {
6161

6262
// But if some are better than others, just drop the worse tier.
6363
func test_too_many_but_some_better() {
64-
let mtch1 = 0 // expected-note {{did you mean 'mtch1'?}}
65-
let mtch2 = 0 // expected-note {{did you mean 'mtch2'?}}
64+
let mtch1 = 0
65+
let mtch2 = 0
6666
let match3 = 0
6767
let match4 = 0
6868
let match5 = 0

test/Serialization/top-level-code.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// CHECK-NOT: UnknownCode
99

10-
let a: Int? = 1 // expected-note {{did you mean 'a'?}}
10+
let a: Int? = 1
1111
guard let b = a else {
1212
fatalError()
1313
}

test/SourceKit/Sema/sema_symlink.swift.response

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@
1919
key.offset: 15,
2020
key.length: 3
2121
}
22-
],
23-
key.diagnostics: [
24-
{
25-
key.line: 1,
26-
key.column: 16,
27-
key.filepath: real.swift,
28-
key.severity: source.diagnostic.severity.note,
29-
key.description: "did you mean 'Bool'? (Swift.Bool)"
30-
}
3122
]
3223
}
3324
]

0 commit comments

Comments
 (0)