blob: 9643780a8e2bf6cc051f64e7fb17d74d41b459bd [file] [log] [blame]
/*
* Copyright (c) 2021, 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.
*/
/**
* @assertion It is an error for the initializer expression of a late local
* variable to use a prefix await expression that is not nested inside of
* another function expression.
*
* @description Check that it is not an error for the initializer expression of
* a late local variable to use a prefix await expression if it is nested inside
* of another function expression
* @author sgrekhov@unipro.ru
*/
// Requirements=nnbd-weak
import "dart:async";
class C {
static void sTest() async {
late Future<int> i = init();
}
void mTest() async {
late Future<int> i = init();
}
}
void test() async {
late Future<int> i = init();
}
Future<int> init() async {
return await 42;
}
main() async {
late Future<int> i = init();
test();
C.sTest();
C().mTest();
}