-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
22 changed files
with
319 additions
and
370 deletions.
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
Language/Statements/Return/no_expression_function_t01.dart
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
Language/Statements/Return/no_expression_function_t02.dart
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
Language/Statements/Return/no_expression_function_t03.dart
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
Language/Statements/Return/no_expression_function_t04.dart
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
Language/Statements/Return/no_expression_function_t05.dart
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
Language/Statements/Return/no_expression_function_t06.dart
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
Language/Statements/Return/no_expression_function_t12.dart
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
Language/Statements/Return/no_expression_function_t15.dart
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
Language/Statements/Return/sync_non_generator_function_A01_t01.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,28 @@ | ||
// Copyright (c) 2011, 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 Consider a return statement `s` of the form `return e?;`. Let `S` | ||
/// be the static type of `e`, if `e` is present, let `f` be the immediately | ||
/// enclosing function, and let `T` be the declared return type of `f`. | ||
/// | ||
/// Case ⟨Synchronous non-generator functions⟩. Consider the case where `f` is a | ||
/// synchronous non-generator function. It is a compile-time error if `s` is | ||
/// `return;`, unless `T` is `void`, `dynamic`, or `Null`. | ||
/// | ||
/// @description Checks that a compile time error occurs if a statement of the | ||
/// form `return;` is used in a top-level method whose declared return type is | ||
/// `int`. | ||
/// @Issue 42459 | ||
/// @author vasya | ||
int bar() { | ||
return; | ||
//^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
main() { | ||
bar(); | ||
} |
29 changes: 29 additions & 0 deletions
29
Language/Statements/Return/sync_non_generator_function_A01_t02.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,29 @@ | ||
// Copyright (c) 2011, 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 Consider a return statement `s` of the form `return e?;`. Let `S` | ||
/// be the static type of `e`, if `e` is present, let `f` be the immediately | ||
/// enclosing function, and let `T` be the declared return type of `f`. | ||
/// | ||
/// Case ⟨Synchronous non-generator functions⟩. Consider the case where `f` is a | ||
/// synchronous non-generator function. It is a compile-time error if `s` is | ||
/// `return;`, unless `T` is `void`, `dynamic`, or `Null`. | ||
/// | ||
/// @description Checks that a compile error occurs if a statement of the form | ||
/// `return;` is used in a getter method whose declared return type is `bool`. | ||
/// @Issue 42459 | ||
/// @author vasya | ||
class C { | ||
bool get foo { | ||
return; | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
} | ||
|
||
main() { | ||
print(C); | ||
} |
37 changes: 37 additions & 0 deletions
37
Language/Statements/Return/sync_non_generator_function_A01_t03.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,37 @@ | ||
// Copyright (c) 2011, 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 Consider a return statement `s` of the form `return e?;`. Let `S` | ||
/// be the static type of `e`, if `e` is present, let `f` be the immediately | ||
/// enclosing function, and let `T` be the declared return type of `f`. | ||
/// | ||
/// Case ⟨Synchronous non-generator functions⟩. Consider the case where `f` is a | ||
/// synchronous non-generator function. It is a compile-time error if `s` is | ||
/// `return;`, unless `T` is `void`, `dynamic`, or `Null`. | ||
/// | ||
/// @description Checks that it is a compile-time error if a statement of the | ||
/// form `return;` is used in a method whose declared return type cannot be | ||
/// assigned to `void`. | ||
/// @Issue 42459 | ||
/// @author rodionov | ||
class C { | ||
static C staticMethod() { | ||
return; | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
int instanceMethod() { | ||
return; | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
} | ||
|
||
main() { | ||
print(C); | ||
} |
35 changes: 35 additions & 0 deletions
35
Language/Statements/Return/sync_non_generator_function_A01_t04.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,35 @@ | ||
// Copyright (c) 2011, 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 Consider a return statement `s` of the form `return e?;`. Let `S` | ||
/// be the static type of `e`, if `e` is present, let `f` be the immediately | ||
/// enclosing function, and let `T` be the declared return type of `f`. | ||
/// | ||
/// Case ⟨Synchronous non-generator functions⟩. Consider the case where `f` is a | ||
/// synchronous non-generator function. It is a compile-time error if `s` is | ||
/// `return;`, unless `T` is `void`, `dynamic`, or `Null`. | ||
/// | ||
/// @description Checks that a compile error occurs if a statement of the form | ||
/// `return;` is used in a method whose declared return type cannot be assigned | ||
/// to `void`. | ||
/// @Issue 42459 | ||
/// @author rodionov | ||
class C { | ||
C() { } | ||
int foo() { | ||
if (true) { | ||
return 1; | ||
} else { | ||
return; | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
} | ||
} | ||
|
||
main() { | ||
print(C); | ||
} |
Oops, something went wrong.