Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2956. Rename, move and update existing return from void tests #2975

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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