diff --git a/LanguageFeatures/Parts-with-imports/scope_A01_t01.dart b/LanguageFeatures/Parts-with-imports/scope_A01_t01.dart new file mode 100644 index 0000000000..5026069e19 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A01_t01.dart @@ -0,0 +1,17 @@ +// 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 As usual, it’s a compile-time error if any import‘s target URI +/// does not resolve to a valid Dart library file. +/// +/// @description Check that it is a compile-time error if an import‘s target +/// URI from a `part` file resolves to a not existing file. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part 'scope_A01_t01_part1.dart'; + +main() { +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A01_t01_part1.dart b/LanguageFeatures/Parts-with-imports/scope_A01_t01_part1.dart new file mode 100644 index 0000000000..7883c57e5d --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A01_t01_part1.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 As usual, it’s a compile-time error if any import‘s target URI +/// does not resolve to a valid Dart library file. +/// +/// @description Check that it is a compile-time error if an import‘s target +/// URI from a `part` file resolves to a not existing file. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A01_t01.dart'; + +import 'not_existing.dart'; +// ^^^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +part 'scope_A01_t01_part2.dart'; diff --git a/LanguageFeatures/Parts-with-imports/scope_A01_t01_part2.dart b/LanguageFeatures/Parts-with-imports/scope_A01_t01_part2.dart new file mode 100644 index 0000000000..5505dd902f --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A01_t01_part2.dart @@ -0,0 +1,19 @@ +// 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 As usual, it’s a compile-time error if any import‘s target URI +/// does not resolve to a valid Dart library file. +/// +/// @description Check that it is a compile-time error if an import‘s target +/// URI from a `part` file resolves to a not existing file. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A01_t01_part1.dart'; + +import 'not_existing.dart'; +// ^^^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified diff --git a/LanguageFeatures/Parts-with-imports/scope_A01_t02.dart b/LanguageFeatures/Parts-with-imports/scope_A01_t02.dart new file mode 100644 index 0000000000..2659e35d9c --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A01_t02.dart @@ -0,0 +1,17 @@ +// 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 As usual, it’s a compile-time error if any import‘s target URI +/// does not resolve to a valid Dart library file. +/// +/// @description Check that it is a compile-time error if an import‘s target +/// URI from a `part` file resolves to a not Dart library file. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part 'scope_A01_t02_part1.dart'; + +main() { +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A01_t02_part1.dart b/LanguageFeatures/Parts-with-imports/scope_A01_t02_part1.dart new file mode 100644 index 0000000000..301356ab41 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A01_t02_part1.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 As usual, it’s a compile-time error if any import‘s target URI +/// does not resolve to a valid Dart library file. +/// +/// @description Check that it is a compile-time error if an import‘s target +/// URI from a `part` file resolves to a not Dart library file. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A01_t02.dart'; + +import 'scope_lib1_part.dart'; +// ^^^^^^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +part 'scope_A01_t02_part2.dart'; diff --git a/LanguageFeatures/Parts-with-imports/scope_A01_t02_part2.dart b/LanguageFeatures/Parts-with-imports/scope_A01_t02_part2.dart new file mode 100644 index 0000000000..666fc0bb71 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A01_t02_part2.dart @@ -0,0 +1,19 @@ +// 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 As usual, it’s a compile-time error if any import‘s target URI +/// does not resolve to a valid Dart library file. +/// +/// @description Check that it is a compile-time error if an import‘s target +/// URI from a `part` file resolves to a not Dart library file. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A01_t02_part1.dart'; + +import 'scope_lib1_part.dart'; +// ^^^^^^^^^^^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t01.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t01.dart new file mode 100644 index 0000000000..441c259348 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t01.dart @@ -0,0 +1,24 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that if unprefixed imports of a part file contain +/// conflicting names it is not an error if those names are not referenced. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part 'scope_A02_t01_part1.dart'; + +main() { + testPart1(); + testPart2(); +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t01_part1.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t01_part1.dart new file mode 100644 index 0000000000..079bfd9590 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t01_part1.dart @@ -0,0 +1,29 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that if unprefixed imports of a part file contain +/// conflicting names it is not an error if those names are not referenced. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t01.dart'; + +import 'scope_lib1.dart'; +import 'parts_lib.dart'; + +part 'scope_A02_t01_part2.dart'; + +testPart1() { + print(scope); // From scope_lib1.dart + print(counter); // From parts_lib.dart +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t01_part2.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t01_part2.dart new file mode 100644 index 0000000000..4293e9784a --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t01_part2.dart @@ -0,0 +1,27 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that if unprefixed imports of a part file contain +/// conflicting names it is not an error if those names are not referenced. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t01_part1.dart'; + +import 'scope_lib1.dart'; +import 'parts_lib.dart'; + +testPart2() { + print(scope); // From scope_lib1.dart + print(counter); // From parts_lib.dart +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t02.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t02.dart new file mode 100644 index 0000000000..da19437c2c --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t02.dart @@ -0,0 +1,24 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that it is a compile-time error if unprefixed imports of +/// a part file contain conflicting names and those names are referenced. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part 'scope_A02_t01_part1.dart'; + +main() { + testPart1(); + testPart2(); +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t02_part1.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t02_part1.dart new file mode 100644 index 0000000000..3c19288171 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t02_part1.dart @@ -0,0 +1,63 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that it is a compile-time error if unprefixed imports of +/// a part file contain conflicting names and those names are referenced. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t02.dart'; + +import 'scope_lib1.dart'; +import 'parts_lib.dart'; + +part 'scope_A02_t02_part2.dart'; + +testPart1() { + print(libVar); +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(libGetter); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + libSetter = ""; +//^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(libFunc); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibClass); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibMixin); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibEnum); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibExt.id); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibET); +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t02_part2.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t02_part2.dart new file mode 100644 index 0000000000..ba194eef45 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t02_part2.dart @@ -0,0 +1,61 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that it is a compile-time error if unprefixed imports of +/// a part file contain conflicting names and those names are referenced. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t02_part1.dart'; + +import 'scope_lib1.dart'; +import 'parts_lib.dart'; + +testPart2() { + print(libVar); +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(libGetter); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + libSetter = ""; +//^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(libFunc); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibClass); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibMixin); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibEnum); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibExt.id); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibET); +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t03.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t03.dart new file mode 100644 index 0000000000..91dadc4088 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t03.dart @@ -0,0 +1,25 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that unprefixed import scope contains all top-level +/// declarations introduced by all the `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +import '../../Utils/expect.dart'; +part 'scope_A02_t03_part1.dart'; + +main() { + testPart1(); + testPart2(); +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t03_part1.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t03_part1.dart new file mode 100644 index 0000000000..ff6becff47 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t03_part1.dart @@ -0,0 +1,39 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that unprefixed import scope contains all top-level +/// declarations introduced by all the `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t03.dart'; + +import 'scope_lib1.dart'; +import 'scope_lib2.dart'; + +part 'scope_A02_t03_part2.dart'; + +testPart1() { + // From scope_lib1.dart + Expect.equals("scope_lib1 libVar", libVar); + Expect.equals("scope_lib1 libGetter", libGetter); + libSetter = "x"; + Expect.equals("scope_lib1 libFunc", libFunc); + Expect.equals("scope_lib1 LibClass", LibClass.id); + Expect.equals("scope_lib1 LibMixin", LibMixin.id); + Expect.equals("scope_lib1 LibEnum", LibEnum.id); + Expect.equals("scope_lib1 LibExt", LibExt.id); + Expect.equals("scope_lib1 LibET", LibET.id); + // From scope_lib2.dart + Expect.equals("scope_lib2", libId); +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t03_part2.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t03_part2.dart new file mode 100644 index 0000000000..c141e3a5f2 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t03_part2.dart @@ -0,0 +1,39 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that unprefixed import scope contains all top-level +/// declarations introduced by all the `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A03_t02_part1.dart'; + +import 'scope_lib1.dart'; +import 'parts_lib.dart'; + +testPart2() { + // From scope_lib1.dart + Expect.equals("scope_lib1 libVar", libVar); + Expect.equals("scope_lib1 libGetter", libGetter); + libSetter = "x"; + Expect.equals("scope_lib1 libFunc", libFunc); + Expect.equals("scope_lib1 LibClass", LibClass.id); + Expect.equals("scope_lib1 LibMixin", LibMixin.id); + Expect.equals("scope_lib1 LibEnum", LibEnum.id); + Expect.equals("scope_lib1 LibExt", LibExt.id); + Expect.equals("scope_lib1 LibET", LibET.id); + // From scope_lib2.dart + Expect.equals("scope_lib2", libId); + // From parts_lib.dart + Expect.equals(0, counter); +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t04.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t04.dart new file mode 100644 index 0000000000..4604ff1fb3 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t04.dart @@ -0,0 +1,24 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that it is a compile-time error to access declarations +/// introduced by `import` directive but hidden by `show` or `hide`. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part 'scope_A02_t04_part1.dart'; + +main() { + testPart1(); + testPart2(); +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t04_part1.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t04_part1.dart new file mode 100644 index 0000000000..820e3dd09d --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t04_part1.dart @@ -0,0 +1,68 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that unprefixed import scope contains all top-level +/// declarations introduced by all the `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t04.dart'; + +import 'scope_lib1.dart' show LibClass; +import 'scope_lib2.dart' hide libId; + +part 'scope_A02_t04_part2.dart'; + +testPart1() { + // From scope_lib1.dart + print(libVar); +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(libGetter); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + libSetter = ""; +//^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(libFunc); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibClass); // Ok + print(LibMixin); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibEnum); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibExt.id); +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(LibET); +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + + // From scope_lib2.dart + print(libId); +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + lib2Func(); // Ok +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t04_part2.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t04_part2.dart new file mode 100644 index 0000000000..bf376f4e0f --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t04_part2.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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that unprefixed import scope contains all top-level +/// declarations introduced by all the `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t04_part1.dart'; + +import 'scope_lib2.dart' show libId; + +testPart2() { + print(libId); // Ok + lib2Func(); // Inherited from the parent +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t05.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t05.dart new file mode 100644 index 0000000000..8d69af750a --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t05.dart @@ -0,0 +1,24 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that it is a compile-time error to access private +/// declarations introduced by `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part 'scope_A02_t05_part1.dart'; + +main() { + testPart1(); + testPart2(); +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t05_part1.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t05_part1.dart new file mode 100644 index 0000000000..e63277e4a5 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t05_part1.dart @@ -0,0 +1,63 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that it is a compile-time error to access private +/// declarations introduced by `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t05.dart'; + +import 'scope_lib1.dart'; + +part 'scope_A02_t05_part2.dart'; + +testPart1() { + // From scope_lib1.dart + print(_libVar); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_libGetter); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + _libSetter = ""; +//^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_libFunc); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibClass); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibMixin); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibEnum); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibExt.id); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibET); +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/LanguageFeatures/Parts-with-imports/scope_A02_t05_part2.dart b/LanguageFeatures/Parts-with-imports/scope_A02_t05_part2.dart new file mode 100644 index 0000000000..2d87cd1e9e --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_A02_t05_part2.dart @@ -0,0 +1,61 @@ +// 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 Let’s introduce importsOf(S), where S is a set of `import` +/// directives from a single Dart file, to refer to that computation, which +/// introduces a scope containing the declarations introduced by all the +/// `import`s (the declarations of the export scope of each imported library, +/// minus those hidden by a `show` or `hide` operator, combined such that a name +/// conflicts of different declarations is not an error, but the name is marked +/// as conflicted in the scope, and then referencing it is an error.) +/// +/// @description Check that unprefixed import scope contains all top-level +/// declarations introduced by all the `import` directives. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_A02_t05_part1.dart'; + +import 'scope_lib1.dart'; + +testPart2() { + // From scope_lib1.dart + print(_libVar); +// ^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_libGetter); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + _libSetter = ""; +//^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_libFunc); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibClass); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibMixin); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibEnum); +// ^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibExt.id); +// ^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + print(_LibET); +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/LanguageFeatures/Parts-with-imports/scope_lib1.dart b/LanguageFeatures/Parts-with-imports/scope_lib1.dart new file mode 100644 index 0000000000..3de9f8d90b --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_lib1.dart @@ -0,0 +1,65 @@ +// 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 Common library for `scope*` tests. +/// +/// @description Common library for `scope*` tests. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part 'scope_lib1_part.dart'; + +String log = ""; + +String libVar = "scope_lib1 libVar"; +String get libGetter => "scope_lib1 libGetter"; +var scope = "scope_lib1"; + +String _libVar = "scope_lib1 _libVar"; +String get _libGetter => "scope_lib1 _libGetter"; +void set _libSetter(String _) { + log = "scope_lib1 _libSetter"; +} +String _libFunc() => "scope_lib1 _libFunc"; + +class LibClass { + static final String id = "scope_lib1 LibClass"; + static final String _id = "scope_lib1 LibClass._id"; + final _private = "scope_lib1 LibClass._private"; +} + +mixin LibMixin { + static final String id = "scope_lib1 LibMixin"; + static final String _id = "scope_lib1 LibMixin._id"; + final _private = "scope_lib1 LibClass._private"; +} + +class A {} + +extension LibExt on A { + static final String id = "scope_lib1 LibExt"; + static final String _id = "scope_lib1 LibExt._id"; +} + +class _LibClass { + static final String id = "scope_lib1 _LibClass"; +} + +mixin _LibMixin { + static final String id = "scope_lib1 _LibMixin"; +} + +extension _LibExt on A { + static final String id = "scope_lib1 _LibExt"; +} + +enum _LibEnum { + e0; + static final String id = "scope_lib1 _LibEnum"; +} + +extension type _LibET(int _) { + static final String id = "scope_lib1 _LibET"; +} diff --git a/LanguageFeatures/Parts-with-imports/scope_lib1_part.dart b/LanguageFeatures/Parts-with-imports/scope_lib1_part.dart new file mode 100644 index 0000000000..a8e54b8a48 --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_lib1_part.dart @@ -0,0 +1,29 @@ +// 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 Common library for `scope*` tests. +/// +/// @description Common library for `scope*` tests. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +part of 'scope_lib1.dart'; + +void set libSetter(String _) { + log = "scope_lib1 libSetter"; +} +String libFunc() => "scope_lib1 libFunc"; + +enum LibEnum { + e0; + static final String id = "scope_lib1 LibEnum"; + static final String _id = "scope_lib1 LibEnum._id"; + final _private = "scope_lib1 LibEnum._private"; +} + +extension type LibET(int _) { + static final String id = "scope_lib1 LibET"; + static final String _id = "scope_lib1 LibET._id"; +} diff --git a/LanguageFeatures/Parts-with-imports/scope_lib2.dart b/LanguageFeatures/Parts-with-imports/scope_lib2.dart new file mode 100644 index 0000000000..316f021f5e --- /dev/null +++ b/LanguageFeatures/Parts-with-imports/scope_lib2.dart @@ -0,0 +1,14 @@ +// 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 Common library for `scope*` tests. +/// +/// @description Common library for `scope*` tests. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=enhanced-parts + +var libId = "scope_lib2"; + +String lib2Func() => "scope_lib2 lib2Func";