Files
sdk/pkg/front_end/testcases/inference_new/while_loop.dart
T
Paul Berry 213c2080a5 Add type inference for while and do loops.
Analyzer does not type infer these constructs correctly (it uses an
empty context for the loop condition, instead of bool), so the tests
are in inference_new.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2954253002 .
2017-06-26 09:07:27 -07:00

17 lines
376 B
Dart

// Copyright (c) 2017, 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.
/*@testedFeatures=inference*/
library test;
T f<T>() => null;
void test() {
while (/*@typeArgs=bool*/ f()) {
var /*@type=int*/ x = 0;
}
}
main() {}