From e6c435f071826494cf7e26a46a7b51fb103ec585 Mon Sep 17 00:00:00 2001 From: "Sergey G. Grekhov" Date: Wed, 21 Feb 2024 14:26:09 +0200 Subject: [PATCH] #2548. Add `out` and `inout` to built-in identifiers tests (#2553) --- .../built_in_identifier_A14_t01.dart | 31 +++++++++++++ .../built_in_identifier_A14_t02.dart | 44 +++++++++++++++++++ .../built_in_identifier_A14_t03.dart | 26 +++++++++++ .../built_in_identifier_A14_t04.dart | 22 ++++++++++ .../built_in_identifier_A14_t05.dart | 21 +++++++++ .../built_in_identifier_A14_t06.dart | 34 ++++++++++++++ .../built_in_identifier_A20_t01.dart | 31 +++++++++++++ .../built_in_identifier_A20_t02.dart | 44 +++++++++++++++++++ .../built_in_identifier_A20_t03.dart | 26 +++++++++++ .../built_in_identifier_A20_t04.dart | 22 ++++++++++ .../built_in_identifier_A20_t05.dart | 21 +++++++++ .../built_in_identifier_A20_t06.dart | 34 ++++++++++++++ 12 files changed, 356 insertions(+) create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A14_t01.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A14_t02.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A14_t03.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A14_t04.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A14_t05.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A14_t06.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A20_t01.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A20_t02.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A20_t03.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A20_t04.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A20_t05.dart create mode 100644 Language/Expressions/Identifier_Reference/built_in_identifier_A20_t06.dart diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t01.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t01.dart new file mode 100644 index 0000000000..104f0e6959 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t01.dart @@ -0,0 +1,31 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `inout` is used as the declared name of a class, mixin or enum. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +class inout {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +mixin inout {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +enum inout {e1;} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t02.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t02.dart new file mode 100644 index 0000000000..a145044b74 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t02.dart @@ -0,0 +1,44 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `inout` is used as the declared name of a type variable. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +class C { +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +mixin M { +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E { +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + e1; +} + +void foo() {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { + print(C); + print(M); + print(E); + print(foo); +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t03.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t03.dart new file mode 100644 index 0000000000..efd479f06e --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t03.dart @@ -0,0 +1,26 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `inout` is used as the declared name of a type alias. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +typedef int inout(); +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +typedef inout = int; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t04.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t04.dart new file mode 100644 index 0000000000..c21e539060 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t04.dart @@ -0,0 +1,22 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `inout` is used as the declared name of a prefix. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +import "../lib.dart" as inout; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { + inout.x; +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t05.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t05.dart new file mode 100644 index 0000000000..fa671f9cb1 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t05.dart @@ -0,0 +1,21 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `inout` is used as the name of an extension. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +extension inout on int {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t06.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t06.dart new file mode 100644 index 0000000000..8fd26cd415 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A14_t06.dart @@ -0,0 +1,34 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `inout` is used as the name, type parameter or alias of an extension +/// type +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=inline-class,variance + +extension type inout(int _) {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +extension type ListET(List _) {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +extension type ET(int _) {} + +typedef inout = ET; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t01.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t01.dart new file mode 100644 index 0000000000..066e6db4aa --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t01.dart @@ -0,0 +1,31 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `out` is used as the declared name of a class, mixin or enum. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +class out {} +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +mixin out {} +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +enum out {e1;} +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t02.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t02.dart new file mode 100644 index 0000000000..afed3ee566 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t02.dart @@ -0,0 +1,44 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `out` is used as the declared name of a type variable. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +class C { +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +mixin M { +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E { +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + e1; +} + +void foo() {} +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { + print(C); + print(M); + print(E); + print(foo); +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t03.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t03.dart new file mode 100644 index 0000000000..fd16ab85ec --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t03.dart @@ -0,0 +1,26 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `out` is used as the declared name of a type alias. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +typedef int out(); +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +typedef out = int; +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t04.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t04.dart new file mode 100644 index 0000000000..67a3022576 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t04.dart @@ -0,0 +1,22 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `out` is used as the declared name of a prefix. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +import "../lib.dart" as out; +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { + out.x; +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t05.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t05.dart new file mode 100644 index 0000000000..a661281fe0 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t05.dart @@ -0,0 +1,21 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `out` is used as the name of an extension. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=variance + +extension out on int {} +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +} diff --git a/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t06.dart b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t06.dart new file mode 100644 index 0000000000..7017450208 --- /dev/null +++ b/Language/Expressions/Identifier_Reference/built_in_identifier_A20_t06.dart @@ -0,0 +1,34 @@ +// 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 It is a syntax error if a built-in identifier is used as the +/// declared name of a prefix, class, mixin, enum, type parameter, type alias, +/// or extension. +/// +/// @description Checks that it is a compile-time error if a built-in identifier +/// `out` is used as the name, type parameter or alias of an extension +/// type +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=inline-class,variance + +extension type out(int _) {} +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +extension type ListET(List _) {} +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +extension type ET(int _) {} + +typedef out = ET; +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { +}