d2e96aa6d3
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>
92 lines
1.6 KiB
Dart
92 lines
1.6 KiB
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.
|
|
|
|
import 'dart:async';
|
|
|
|
methodDirect<T>(T value) {
|
|
late final T local2;
|
|
late final int local4;
|
|
late final FutureOr<int> local6;
|
|
|
|
local2 = value; // ok
|
|
local4 = 0; // ok
|
|
local6 = 0; // ok
|
|
|
|
local2 = value; // error
|
|
local4 = 0; // error
|
|
local6 = 0; // error
|
|
}
|
|
|
|
var fieldDirect = <T>(T value) {
|
|
late final T local2;
|
|
late final int local4;
|
|
late final FutureOr<int> local6;
|
|
|
|
local2 = value; // ok
|
|
local4 = 0; // ok
|
|
local6 = 0; // ok
|
|
|
|
local2 = value; // error
|
|
local4 = 0; // error
|
|
local6 = 0; // error
|
|
};
|
|
|
|
methodConditional<T>(bool b, T value) {
|
|
late final T local2;
|
|
late final int local4;
|
|
late final FutureOr<int> local6;
|
|
|
|
if (b) {
|
|
local2 = value; // ok
|
|
local4 = 0; // ok
|
|
local6 = 0; // ok
|
|
}
|
|
|
|
local2 = value; // ok
|
|
local4 = 0; // ok
|
|
local6 = 0; // ok
|
|
|
|
local2 = value; // error
|
|
local4 = 0; // error
|
|
local6 = 0; // error
|
|
}
|
|
|
|
var fieldConditional = <T>(bool b, T value) {
|
|
late final T local2;
|
|
late final int local4;
|
|
late final FutureOr<int> local6;
|
|
|
|
if (b) {
|
|
local2 = value; // ok
|
|
local4 = 0; // ok
|
|
local6 = 0; // ok
|
|
}
|
|
|
|
local2 = value; // ok
|
|
local4 = 0; // ok
|
|
local6 = 0; // ok
|
|
|
|
local2 = value; // error
|
|
local4 = 0; // error
|
|
local6 = 0; // error
|
|
};
|
|
|
|
methodCompound() {
|
|
late final int local4;
|
|
|
|
local4 = 0; // ok
|
|
|
|
local4 += 0; // error
|
|
}
|
|
|
|
var fieldCompound = () {
|
|
late final int local4;
|
|
|
|
local4 = 0; // ok
|
|
|
|
local4 += 0; // error
|
|
};
|
|
|
|
main() {}
|