Skip to content

Commit

Permalink
#2956. Rename, move and update existing return from void tests (#2975)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov authored Nov 12, 2024
1 parent 3ae290b commit 3a07e0e
Show file tree
Hide file tree
Showing 22 changed files with 319 additions and 370 deletions.
27 changes: 0 additions & 27 deletions Language/Statements/Return/no_expression_function_t01.dart

This file was deleted.

29 changes: 0 additions & 29 deletions Language/Statements/Return/no_expression_function_t02.dart

This file was deleted.

30 changes: 0 additions & 30 deletions Language/Statements/Return/no_expression_function_t03.dart

This file was deleted.

30 changes: 0 additions & 30 deletions Language/Statements/Return/no_expression_function_t04.dart

This file was deleted.

34 changes: 0 additions & 34 deletions Language/Statements/Return/no_expression_function_t05.dart

This file was deleted.

33 changes: 0 additions & 33 deletions Language/Statements/Return/no_expression_function_t06.dart

This file was deleted.

29 changes: 0 additions & 29 deletions Language/Statements/Return/no_expression_function_t12.dart

This file was deleted.

34 changes: 0 additions & 34 deletions Language/Statements/Return/no_expression_function_t15.dart

This file was deleted.

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();
}
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);
}
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);
}
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);
}
Loading

0 comments on commit 3a07e0e

Please sign in to comment.