diff --git a/Language/Types/Type_Void/type_void_A04_t01.dart b/Language/Types/Type_Void/type_void_A04_t01.dart index 9a81b7e398..d36a40c40e 100644 --- a/Language/Types/Type_Void/type_void_A04_t01.dart +++ b/Language/Types/Type_Void/type_void_A04_t01.dart @@ -12,7 +12,7 @@ void f() {} // ^^^^ // [analyzer] unspecified -// [cfe] unspecified> +// [cfe] unspecified class A {} // ^^^^ @@ -23,11 +23,11 @@ class B { static void foo() {} // ^^^^ // [analyzer] unspecified -// [cfe] unspecified> +// [cfe] unspecified void bar() {} // ^^^^ // [analyzer] unspecified -// [cfe] unspecified> +// [cfe] unspecified } mixin M {} diff --git a/Language/Types/Type_Void/type_void_A04_t03.dart b/Language/Types/Type_Void/type_void_A04_t03.dart new file mode 100644 index 0000000000..33ed9ece2d --- /dev/null +++ b/Language/Types/Type_Void/type_void_A04_t03.dart @@ -0,0 +1,94 @@ +// Copyright (c) 2024, 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 The special type `void` is used to indicate that the value of an +/// expression is meaningless and intended to be discarded. +/// +/// @description Checks that a type with `void` bound is not treated the same +/// way as the type `dynamic`, by attempting to invoke a non-existing member. +/// @author sgrekhov22@gmail.com + +typedef Void = void; + +void f(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class A { + T t; + A(this.t); + + test() { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +class B { + static void foo(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + void bar(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +mixin M { + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +enum E { + e0; + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +class C {} + +extension Ext on C { + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +extension type ET(int _) { + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +main() { + print(f); + print(A); + print(M); + print(E); + print(C); + print(ET); +} diff --git a/Language/Types/Type_dynamic/generic_A01_t01.dart b/Language/Types/Type_dynamic/generic_A01_t01.dart new file mode 100644 index 0000000000..41878feb32 --- /dev/null +++ b/Language/Types/Type_dynamic/generic_A01_t01.dart @@ -0,0 +1,93 @@ +// Copyright (c) 2024, 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 If a generic type is used but type arguments are not provided, +/// the type arguments default to type `dynamic`. +/// +/// @description Checks that a static type of a type parameter with no bounds is +/// not treated the same way as the type `dynamic`, by attempting to invoke a +/// non-existing member. +/// @author sgrekhov22@gmail.com + +void f(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class A { + T t; + A(this.t); + + test() { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +class B { + static void foo(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + void bar(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +mixin M { + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +enum E { + e0; + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +class C {} + +extension Ext on C { + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +extension type ET(int _) { + test(T t) { + t.nonExistingMember; +// ^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +main() { + print(f); + print(A); + print(M); + print(E); + print(C); + print(ET); +} diff --git a/Language/Types/Type_dynamic/generic_A02_t01.dart b/Language/Types/Type_dynamic/generic_A02_t01.dart new file mode 100644 index 0000000000..3a44560d9c --- /dev/null +++ b/Language/Types/Type_dynamic/generic_A02_t01.dart @@ -0,0 +1,78 @@ +// Copyright (c) 2024, 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 If a generic type is used but type arguments are not provided, +/// the type arguments default to type `dynamic`. +/// +/// @description Checks that a type with `dynamic` as a bound is treated the +/// same as the type `dynamic`, and similarly for a bound which is a type alias +/// of `dynamic`. +/// @author sgrekhov22@gmail.com + +typedef Dynamic = dynamic; + +void f1(T t) { + t.whatever; +} + +void f2(T t) { + t.whatever; +} + +class A { + T1 t1; + T2 t2; + A(this.t1, this.t2); + + test() { + t1.whatever; + t2.whatever; + } +} + +class B { + static void foo(T t) { + t.whatever; + } + void bar(T t) { + t.whatever; + } +} + +mixin M { + test(T t) { + t.whatever; + } +} + +enum E { + e0; + test(T t) { + t.whatever; + } +} + +class C {} + +extension Ext on C { + test(T t) { + t.whatever; + } +} + +extension type ET(int _) { + test(T t) { + t.whatever; + } +} + +main() { + print(f1); + print(f2); + print(A); + print(M); + print(E); + print(C); + print(ET); +}