Files
sdk/pkg/front_end/testcases/late_lowering/compound.dart
T
Johnni Winther d2e96aa6d3 [cfe] Report error on (un)assigned late variables
Closes #40601
Closes #41103
Closes #40946

Change-Id: I1a28f497ffe0be3d1f9e673f1e8be7a518bbfc7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140403
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-23 14:48:53 +00:00

26 lines
549 B
Dart

// Copyright (c) 2020, 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.
main() {
late int local1;
local1 = 0;
expect(0, local1);
local1 += 2;
expect(2, local1);
late int local2 = 1;
expect(1, local2);
local2 += 2;
expect(3, local2);
}
error() {
late final int local;
local += 0;
}
expect(expected, actual) {
if (expected != actual) throw 'Expected $expected, actual $actual';
}