Skip to content

Commit 4743211

Browse files
eernstgcommit-bot@chromium.org
authored andcommitted
Add new tests, cf. #1060 (void generators)
Change-Id: I7a2bcc85731e426c6d0073d65c06878f917d6627 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154681 Reviewed-by: Lasse R.H. Nielsen <[email protected]> Commit-Queue: Erik Ernst <[email protected]>
1 parent 22e3406 commit 4743211

File tree

4 files changed

+148
-0
lines changed

4 files changed

+148
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// It is an error for an `async*` function to have return type `void`.
6+
7+
import 'dart:async';
8+
9+
/*space*/ void f1() async* {
10+
// ^^^^
11+
// [analyzer] unspecified
12+
// [cfe] unspecified
13+
}
14+
15+
class C {
16+
static void f2() async* {
17+
// ^^^^
18+
// [analyzer] unspecified
19+
// [cfe] unspecified
20+
}
21+
22+
/*space*/ void f3() async* {
23+
// ^^^^
24+
// [analyzer] unspecified
25+
// [cfe] unspecified
26+
}
27+
}
28+
29+
void main() {
30+
/*space*/ void f4() async* {
31+
// ^^^^
32+
// [analyzer] unspecified
33+
// [cfe] unspecified
34+
}
35+
36+
// No function literal: It is probably not possible to infer the
37+
// return type `void` for a function literal marked `async*`.
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// It is an error for a `sync*` function to have return type `void`.
6+
7+
/*space*/ void f1() sync* {
8+
// ^^^^
9+
// [analyzer] unspecified
10+
// [cfe] unspecified
11+
}
12+
13+
class C {
14+
static void f2() sync* {
15+
// ^^^^
16+
// [analyzer] unspecified
17+
// [cfe] unspecified
18+
}
19+
20+
/*space*/ void f3() sync* {
21+
// ^^^^
22+
// [analyzer] unspecified
23+
// [cfe] unspecified
24+
}
25+
}
26+
27+
void main() {
28+
/*space*/ void f4() sync* {
29+
// ^^^^
30+
// [analyzer] unspecified
31+
// [cfe] unspecified
32+
}
33+
34+
// No function literal: It is probably not possible to infer the
35+
// return type `void` for a function literal marked `sync*`.
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// It is an error for an `async*` function to have return type `void`.
6+
7+
import 'dart:async';
8+
9+
/*space*/ void f1() async* {
10+
// ^^^^
11+
// [analyzer] unspecified
12+
// [cfe] unspecified
13+
}
14+
15+
class C {
16+
static void f2() async* {
17+
// ^^^^
18+
// [analyzer] unspecified
19+
// [cfe] unspecified
20+
}
21+
22+
/*space*/ void f3() async* {
23+
// ^^^^
24+
// [analyzer] unspecified
25+
// [cfe] unspecified
26+
}
27+
}
28+
29+
void main() {
30+
/*space*/ void f4() async* {
31+
// ^^^^
32+
// [analyzer] unspecified
33+
// [cfe] unspecified
34+
}
35+
36+
// No function literal: It is probably not possible to infer the
37+
// return type `void` for a function literal marked `async*`.
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// It is an error for a `sync*` function to have return type `void`.
6+
7+
/*space*/ void f1() sync* {
8+
// ^^^^
9+
// [analyzer] unspecified
10+
// [cfe] unspecified
11+
}
12+
13+
class C {
14+
static void f2() sync* {
15+
// ^^^^
16+
// [analyzer] unspecified
17+
// [cfe] unspecified
18+
}
19+
20+
/*space*/ void f3() sync* {
21+
// ^^^^
22+
// [analyzer] unspecified
23+
// [cfe] unspecified
24+
}
25+
}
26+
27+
void main() {
28+
/*space*/ void f4() sync* {
29+
// ^^^^
30+
// [analyzer] unspecified
31+
// [cfe] unspecified
32+
}
33+
34+
// No function literal: It is probably not possible to infer the
35+
// return type `void` for a function literal marked `sync*`.
36+
}

0 commit comments

Comments
 (0)