From edd9a56b18435af625aa172da4c25a662b3c2ad3 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Tue, 12 Nov 2024 13:18:10 +0200 Subject: [PATCH] #2956. Rename, move and update existing return from `void` tests --- .../Return/no_expression_function_t01.dart | 27 ----------- .../Return/no_expression_function_t02.dart | 29 ----------- .../Return/no_expression_function_t03.dart | 30 ------------ .../Return/no_expression_function_t04.dart | 30 ------------ .../Return/no_expression_function_t05.dart | 34 ------------- .../Return/no_expression_function_t06.dart | 33 ------------- .../Return/no_expression_function_t12.dart | 29 ----------- .../Return/no_expression_function_t15.dart | 34 ------------- .../sync_non_generator_function_A01_t01.dart | 28 +++++++++++ .../sync_non_generator_function_A01_t02.dart | 29 +++++++++++ .../sync_non_generator_function_A01_t03.dart | 37 ++++++++++++++ .../sync_non_generator_function_A01_t04.dart | 35 ++++++++++++++ .../sync_non_generator_function_A01_t05.dart | 40 ++++++++++++++++ .../sync_non_generator_function_A01_t06.dart | 45 +++++++++++++++++ .../sync_non_generator_function_A02_t01.dart | 27 +++++++++++ .../sync_non_generator_function_A02_t02.dart | 30 ++++++++++++ .../sync_non_generator_function_A02_t03.dart | 48 +++++++++++++++++++ Language/Types/Type_Void/returning_t01.dart | 21 -------- Language/Types/Type_Void/returning_t02.dart | 27 ----------- Language/Types/Type_Void/returning_t03.dart | 25 ---------- Language/Types/Type_Void/returning_t04.dart | 25 ---------- Language/Types/Type_Void/returning_t05.dart | 26 ---------- 22 files changed, 319 insertions(+), 370 deletions(-) delete mode 100644 Language/Statements/Return/no_expression_function_t01.dart delete mode 100644 Language/Statements/Return/no_expression_function_t02.dart delete mode 100644 Language/Statements/Return/no_expression_function_t03.dart delete mode 100644 Language/Statements/Return/no_expression_function_t04.dart delete mode 100644 Language/Statements/Return/no_expression_function_t05.dart delete mode 100644 Language/Statements/Return/no_expression_function_t06.dart delete mode 100644 Language/Statements/Return/no_expression_function_t12.dart delete mode 100644 Language/Statements/Return/no_expression_function_t15.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A01_t01.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A01_t02.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A01_t03.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A01_t04.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A01_t05.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A01_t06.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A02_t01.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A02_t02.dart create mode 100644 Language/Statements/Return/sync_non_generator_function_A02_t03.dart delete mode 100644 Language/Types/Type_Void/returning_t01.dart delete mode 100644 Language/Types/Type_Void/returning_t02.dart delete mode 100644 Language/Types/Type_Void/returning_t03.dart delete mode 100644 Language/Types/Type_Void/returning_t04.dart delete mode 100644 Language/Types/Type_Void/returning_t05.dart diff --git a/Language/Statements/Return/no_expression_function_t01.dart b/Language/Statements/Return/no_expression_function_t01.dart deleted file mode 100644 index 4280f720de..0000000000 --- a/Language/Statements/Return/no_expression_function_t01.dart +++ /dev/null @@ -1,27 +0,0 @@ -// 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?; -/// ... -/// 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(); -} diff --git a/Language/Statements/Return/no_expression_function_t02.dart b/Language/Statements/Return/no_expression_function_t02.dart deleted file mode 100644 index d46f671d00..0000000000 --- a/Language/Statements/Return/no_expression_function_t02.dart +++ /dev/null @@ -1,29 +0,0 @@ -// 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?; -/// ... -/// 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 { - C() { } - bool get foo { - return; -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - } -} - -main() { - bool x = new C().foo; -} diff --git a/Language/Statements/Return/no_expression_function_t03.dart b/Language/Statements/Return/no_expression_function_t03.dart deleted file mode 100644 index e8c9c8eab8..0000000000 --- a/Language/Statements/Return/no_expression_function_t03.dart +++ /dev/null @@ -1,30 +0,0 @@ -// 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?; -/// ... -/// It is a compile-time error if s is -/// return;, unless T is void, dynamic, or Null -/// -/// @description Checks that a static warning occurs if a statement of the form -/// "return;" is used in a static method whose declared return type may not be -/// assigned to void. -/// -/// @Issue 42459 -/// @author rodionov - - -class C { - C() { } - static C foo() { - return; -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - } -} - -main() { - C.foo(); -} diff --git a/Language/Statements/Return/no_expression_function_t04.dart b/Language/Statements/Return/no_expression_function_t04.dart deleted file mode 100644 index 8a58f1d164..0000000000 --- a/Language/Statements/Return/no_expression_function_t04.dart +++ /dev/null @@ -1,30 +0,0 @@ -// 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?; -/// ... -/// 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 an instance method whose declared return type may not be -/// assigned to void. -/// -/// @Issue 42459 -/// @author rodionov - - -class C { - C() { } - int foo() { - return; -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - } -} - -main() { - new C().foo(); -} diff --git a/Language/Statements/Return/no_expression_function_t05.dart b/Language/Statements/Return/no_expression_function_t05.dart deleted file mode 100644 index 9f965b7559..0000000000 --- a/Language/Statements/Return/no_expression_function_t05.dart +++ /dev/null @@ -1,34 +0,0 @@ -// 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?; -/// ... -/// 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 an instance method whose declared return type may not be -/// assigned to void. -/// -/// @Issue 42459 -/// @author rodionov - - -class C { - C() { } - int foo() { - if (true) { - return 1; - } else { - return; -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - } - } -} - -main() { - new C().foo(); -} diff --git a/Language/Statements/Return/no_expression_function_t06.dart b/Language/Statements/Return/no_expression_function_t06.dart deleted file mode 100644 index da563fb544..0000000000 --- a/Language/Statements/Return/no_expression_function_t06.dart +++ /dev/null @@ -1,33 +0,0 @@ -// 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?; -/// ... -/// It is a compile-time error if s is -/// return;, unless T is void, dynamic, or Null -/// -/// @description Checks that there's no error when a statement of the form -/// "return;" is used in a method that returns type dynamic, or a constructor. -/// -/// @author rodionov - - -abstract class I { - factory I() { return new C(); } -} - -class C implements I { - C() { return; } - static sm() { return; } - get g { return; } - foo() { return; } -} - -main() { - dynamic x = new C(); - x = C.sm(); - x = new C().foo(); - x = new C().g; - x = new I(); -} diff --git a/Language/Statements/Return/no_expression_function_t12.dart b/Language/Statements/Return/no_expression_function_t12.dart deleted file mode 100644 index 74cda6f482..0000000000 --- a/Language/Statements/Return/no_expression_function_t12.dart +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2016, 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?; -/// ... -/// It is a compile-time error if s is -/// return;, unless T is void, dynamic, or Null -/// -/// @description Checks that there's no compile error when a statement of the -/// form "return;" is used in a method that whose return type is void -/// -/// @author a.semenov@unipro.ru - - -void bar() { - return; -} - -class C { - static void sm() { return; } - void foo() { return; } -} - -main() { - bar(); - C.sm(); - new C().foo(); -} diff --git a/Language/Statements/Return/no_expression_function_t15.dart b/Language/Statements/Return/no_expression_function_t15.dart deleted file mode 100644 index 4475c7522f..0000000000 --- a/Language/Statements/Return/no_expression_function_t15.dart +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2016, 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?; -/// ... -/// It is a compile-time error if s is -/// return;, unless T is void, dynamic, or Null -/// -/// @description Checks that there's no compile error when a statement of the -/// form "return;" is used in a synchronous function whose return type is -/// not specified -/// -/// @author a.semenov@unipro.ru - - -bar() { - return; -} - -class C { - static sm() { - return; - } - foo() { - return; - } -} - -main() { - bar(); - C.sm(); - new C().foo(); -} diff --git a/Language/Statements/Return/sync_non_generator_function_A01_t01.dart b/Language/Statements/Return/sync_non_generator_function_A01_t01.dart new file mode 100644 index 0000000000..8d6d1707c0 --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A01_t01.dart @@ -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(); +} diff --git a/Language/Statements/Return/sync_non_generator_function_A01_t02.dart b/Language/Statements/Return/sync_non_generator_function_A01_t02.dart new file mode 100644 index 0000000000..f90bfe2fb4 --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A01_t02.dart @@ -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); +} diff --git a/Language/Statements/Return/sync_non_generator_function_A01_t03.dart b/Language/Statements/Return/sync_non_generator_function_A01_t03.dart new file mode 100644 index 0000000000..a5d1bc8a7f --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A01_t03.dart @@ -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); +} diff --git a/Language/Statements/Return/sync_non_generator_function_A01_t04.dart b/Language/Statements/Return/sync_non_generator_function_A01_t04.dart new file mode 100644 index 0000000000..53d438246a --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A01_t04.dart @@ -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); +} diff --git a/Language/Statements/Return/sync_non_generator_function_A01_t05.dart b/Language/Statements/Return/sync_non_generator_function_A01_t05.dart new file mode 100644 index 0000000000..9a56920bd8 --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A01_t05.dart @@ -0,0 +1,40 @@ +// 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 there's no error when a statement of the form +/// `return;` is used in a method that returns type `dynamic`, or in a +/// constructor. +/// @author rodionov + +class C { + C() { + return; + } + static sm() { + return; + } + + get g { + return; + } + + foo() { + return; + } +} + +main() { + C(); + C.sm(); + C().foo(); + C().g; +} diff --git a/Language/Statements/Return/sync_non_generator_function_A01_t06.dart b/Language/Statements/Return/sync_non_generator_function_A01_t06.dart new file mode 100644 index 0000000000..0f1296e730 --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A01_t06.dart @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 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 there's no compile error when a statement of the +/// form `return;` is used in a method whose return type is `void`. +/// @author a.semenov@unipro.ru + +void bar() { + return; +} + +void set baz(int v) { + return; +} + +class C { + static void sm() { + return; + } + + void foo() { + return; + } + + void set qux(int v) { + return; + } +} + +main() { + bar(); + baz = 0; + C.sm(); + C().foo(); + C().qux = 1; +} diff --git a/Language/Statements/Return/sync_non_generator_function_A02_t01.dart b/Language/Statements/Return/sync_non_generator_function_A02_t01.dart new file mode 100644 index 0000000000..fe4fb1fcdf --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A02_t01.dart @@ -0,0 +1,27 @@ +// 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 e;`, `T` is `void`, and `S` is +/// neither `void`, `dynamic`, nor `Null`. +/// +/// @description Checks that returning the result of a `void` method invocation +/// from within a `void` method does not cause any errors or warnings. +/// @author rodionov + +void foo() {} + +void bar() { + return foo(); +} + +main() { + bar(); +} diff --git a/Language/Statements/Return/sync_non_generator_function_A02_t02.dart b/Language/Statements/Return/sync_non_generator_function_A02_t02.dart new file mode 100644 index 0000000000..33f2d90fc6 --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A02_t02.dart @@ -0,0 +1,30 @@ +// 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 e;`, `T` is `void`, and `S` is +/// neither `void`, `dynamic`, nor `Null`. +/// +/// @description Checks that returning `null` or a value with static type +/// `dynamic` from within a `void` method does not result in a warning or error. +/// @author rodionov + +void foo() { + return null; +} + +void bar(dynamic v) { + return v; +} + +main() { + foo(); + bar(1); +} diff --git a/Language/Statements/Return/sync_non_generator_function_A02_t03.dart b/Language/Statements/Return/sync_non_generator_function_A02_t03.dart new file mode 100644 index 0000000000..e1ed127d52 --- /dev/null +++ b/Language/Statements/Return/sync_non_generator_function_A02_t03.dart @@ -0,0 +1,48 @@ +// 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 e;`, `T` is `void`, and `S` is +/// neither `void`, `dynamic`, nor `Null`. +/// +/// @description Checks that returning a non-null value with non-dynamic static +/// type from within a `void` method produces a compile error. +/// @author rodionov + +void foo() { + String s = "foo"; + return s; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +void bar() { + Object? o = null; + return o; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +void f() {} + +void baz() { + return f; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +main() { + foo(); + bar(); + baz(); +} diff --git a/Language/Types/Type_Void/returning_t01.dart b/Language/Types/Type_Void/returning_t01.dart deleted file mode 100644 index afce877bc4..0000000000 --- a/Language/Types/Type_Void/returning_t01.dart +++ /dev/null @@ -1,21 +0,0 @@ -// 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 On the other hand, it is possible to return the result of a void -/// method from within a void method. One can also return null; or a value of -/// type Dynamic. Returning any other result will cause a type warning. A compile -/// time error would arise if a non-null object was returned from a void method -/// (since no object has runtime type dynamic). -/// @description Checks that returning the result of a void method invocation -/// from within a void method does not cause any errors or warnings. -/// @author rodionov - - -void foo() {} - -void bar() {return foo();} - -main() { - bar(); -} diff --git a/Language/Types/Type_Void/returning_t02.dart b/Language/Types/Type_Void/returning_t02.dart deleted file mode 100644 index c3c95d593a..0000000000 --- a/Language/Types/Type_Void/returning_t02.dart +++ /dev/null @@ -1,27 +0,0 @@ -// 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 On the other hand, it is possible to return the result of a void -/// method from within a void method. One can also return null; or a value of -/// type Dynamic. Returning any other result will cause a type warning. A compile -/// time error would arise if a non-null object was returned from a void method -/// (since no object has runtime type dynamic). -/// @description Checks that returning null or a value with static type dynamic -/// from within a void method does not result in a static type warning or any -/// error -/// @author rodionov - - -void foo() { - return null; -} - -void bar(var v) { - return v; -} - -main() { - foo(); - bar(1); -} diff --git a/Language/Types/Type_Void/returning_t03.dart b/Language/Types/Type_Void/returning_t03.dart deleted file mode 100644 index 6bbea1b5d9..0000000000 --- a/Language/Types/Type_Void/returning_t03.dart +++ /dev/null @@ -1,25 +0,0 @@ -// 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 On the other hand, it is possible to return the result of a void -/// method from within a void method. One can also return null; or a value of -/// type Dynamic. Returning any other result will cause a type warning. A compile -/// time error would arise if a non-null object was returned from a void method -/// (since no object has runtime type dynamic). -/// @description Checks that returning a non-null value with non-dynamic static -/// type from within a void method produces compile error. -/// @author rodionov - - -void foo() { - String s = "foo"; - return s; -// ^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - foo(); -} diff --git a/Language/Types/Type_Void/returning_t04.dart b/Language/Types/Type_Void/returning_t04.dart deleted file mode 100644 index c3be573142..0000000000 --- a/Language/Types/Type_Void/returning_t04.dart +++ /dev/null @@ -1,25 +0,0 @@ -// 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 On the other hand, it is possible to return the result of a void -/// method from within a void method. One can also return null; or a value of -/// type Dynamic. Returning any other result will cause a type warning. A compile -/// time error would arise if a non-null object was returned from a void method -/// (since no object has runtime type dynamic). -/// @description Checks that returning a non-null value with non-dynamic static -/// type from within a void method produces compile error. -/// @author rodionov - - -void foo() { - Object o = new Object(); - return o; -// ^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - foo(); -} diff --git a/Language/Types/Type_Void/returning_t05.dart b/Language/Types/Type_Void/returning_t05.dart deleted file mode 100644 index 1b69c606f0..0000000000 --- a/Language/Types/Type_Void/returning_t05.dart +++ /dev/null @@ -1,26 +0,0 @@ -// 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 On the other hand, it is possible to return the result of a void -/// method from within a void method. One can also return null; or a value of -/// type Dynamic. Returning any other result will cause a type warning. A compile -/// time error would arise if a non-null object was returned from a void method -/// (since no object has runtime type dynamic). -/// @description Checks that returning a non-null value with non-dynamic static -/// type from within a void method produces compile error. -/// @author rodionov - - -void f() {} - -void foo() { - return f; -// ^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - foo(); -}