Skip to content

Commit 26eceee

Browse files
authored
Merge pull request #9919 from bitjammer/rdar-32390791-migrator-no-var-let-for
[Migrator] Don't take var -> let fix-it
2 parents 3232415 + f1ab157 commit 26eceee

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

include/swift/Migrator/FixitFilter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ struct FixitFilter {
102102
// Fixits from warnings/notes that should be applied.
103103
if (Info.ID == diag::forced_downcast_coercion.ID ||
104104
Info.ID == diag::forced_downcast_noop.ID ||
105-
Info.ID == diag::variable_never_mutated.ID ||
106105
Info.ID == diag::function_type_no_parens.ID ||
107106
Info.ID == diag::convert_let_to_var.ID ||
108107
Info.ID == diag::parameter_extraneous_double_up.ID ||

test/Migrator/no_var_to_let.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %target-swift-frontend -typecheck %s -swift-version 3
2+
// RUN: rm -rf %t && mkdir -p %t && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/no_var_to_let.swift.result -swift-version 3 -o /dev/null
3+
// RUN: diff -u %s %t/no_var_to_let.swift.result
4+
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
5+
6+
// Note that the diff run line indicates that there should be no change.
7+
8+
// The compiler should not suggest `let` instead of `var` here because
9+
// it is a compile error to say `for let ...`.
10+
// rdar://problem/32390726
11+
12+
for var i in 0..<10 {
13+
_ = i + 1
14+
}

0 commit comments

Comments
 (0)