forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dart-lang#2825. Add scope tests. Part 1. (dart-lang#2845)
Add scope tests. Part 1. Note that import clauses in a part file are currently a syntax error, but will be supported.
- Loading branch information
Showing
24 changed files
with
819 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'scope_A01_t01_part1.dart'; | ||
|
||
main() { | ||
} |
21 changes: 21 additions & 0 deletions
21
LanguageFeatures/Parts-with-imports/scope_A01_t01_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// 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'; |
19 changes: 19 additions & 0 deletions
19
LanguageFeatures/Parts-with-imports/scope_A01_t01_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'scope_A01_t01_part1.dart'; | ||
|
||
import 'not_existing.dart'; | ||
// ^^^^^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'scope_A01_t02_part1.dart'; | ||
|
||
main() { | ||
} |
21 changes: 21 additions & 0 deletions
21
LanguageFeatures/Parts-with-imports/scope_A01_t02_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// 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'; |
19 changes: 19 additions & 0 deletions
19
LanguageFeatures/Parts-with-imports/scope_A01_t02_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part of 'scope_A01_t02_part1.dart'; | ||
|
||
import 'scope_lib1_part.dart'; | ||
// ^^^^^^^^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'scope_A02_t01_part1.dart'; | ||
|
||
main() { | ||
testPart1(); | ||
testPart2(); | ||
} |
29 changes: 29 additions & 0 deletions
29
LanguageFeatures/Parts-with-imports/scope_A02_t01_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// 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 | ||
} |
27 changes: 27 additions & 0 deletions
27
LanguageFeatures/Parts-with-imports/scope_A02_t01_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
part 'scope_A02_t01_part1.dart'; | ||
|
||
main() { | ||
testPart1(); | ||
testPart2(); | ||
} |
63 changes: 63 additions & 0 deletions
63
LanguageFeatures/Parts-with-imports/scope_A02_t02_part1.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// 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 | ||
} |
61 changes: 61 additions & 0 deletions
61
LanguageFeatures/Parts-with-imports/scope_A02_t02_part2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-parts | ||
|
||
import '../../Utils/expect.dart'; | ||
part 'scope_A02_t03_part1.dart'; | ||
|
||
main() { | ||
testPart1(); | ||
testPart2(); | ||
} |
Oops, something went wrong.