-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I4fc4bc583f6fe25a0a083efc6b9cda5ef9ae5ceb Reviewed-on: https://dart-review.googlesource.com/66521 Commit-Queue: Leaf Petersen <leafp@google.com> Reviewed-by: Erik Ernst <eernst@google.com>
- Loading branch information
1 parent
35a982b
commit 1a83245
Showing
94 changed files
with
2,420 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Feature tests for invalid returns | ||
|
||
This directory holds tests for valid and invalid returns from functions. See | ||
the | ||
[feature specification](https://github.com/dart-lang/sdk/blob/master/docs/language/informal/generalized-void.md) for | ||
details, or the formal spec once integrated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
tests/language_2/invalid_returns/async_invalid_return_01_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return;` is an error if `flatten(T)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<int> test() async { | ||
return; //# none: static type warning | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/language_2/invalid_returns/async_invalid_return_02_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return;` is an error if `flatten(T)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
FutureOr<int> test() async { | ||
return; //# none: static type warning | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/language_2/invalid_returns/async_invalid_return_03_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return;` is an error if `flatten(T)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<Object> test() async { | ||
return; //# none: static type warning | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/language_2/invalid_returns/async_invalid_return_04_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return;` is an error if `flatten(T)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
FutureOr<Object> test() async { | ||
return; //# none: static type warning | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_05_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
int v = null; | ||
void test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_06_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
int v = null; | ||
Future<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_07_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
int v = null; | ||
FutureOr<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_08_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Object v = null; | ||
void test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_09_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Object v = null; | ||
Future<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_10_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Object v = null; | ||
FutureOr<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_11_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<int> v = null; | ||
void test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_12_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<int> v = null; | ||
Future<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_13_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<int> v = null; | ||
FutureOr<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_14_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
FutureOr<int> v = null; | ||
void test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_15_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
FutureOr<int> v = null; | ||
Future<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_16_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
FutureOr<int> v = null; | ||
FutureOr<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_17_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<Object> v = null; | ||
void test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_18_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<Object> v = null; | ||
Future<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_19_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
Future<Object> v = null; | ||
FutureOr<void> test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/language_2/invalid_returns/async_invalid_return_20_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2018, 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'; | ||
|
||
/* | ||
* `return exp;` where `exp` has static type `S` is an error if `flatten(T)` is | ||
`void` and `flatten(S)` is not `void`, `dynamic`, or `Null` | ||
*/ | ||
FutureOr<Object> v = null; | ||
void test() async { | ||
return /*@compile-error=unspecified*/ v; | ||
} | ||
|
||
void main() { | ||
test(); | ||
} |
Oops, something went wrong.