blob: 610a351badd49059a50de650cc53045ab91b7931 [file] [log] [blame]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// test w/ `dart test -N prefer_final_in_for_each`
void fn() {
for (var i in [1, 2, 3]) { // LINT
print(i);
}
for (final i in [1, 2, 3]) { // OK
print(i);
}
for (var i in [1, 2, 3]) { // OK
i += 1;
print(i);
}
int j;
for (j in [1, 2, 3]) { // OK
print(j);
}
}