Skip to content

Commit

Permalink
dart-lang#2825. Fix dotted.library.name syntax in part of directive
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Oct 7, 2024
1 parent 582818c commit e7fd9a9
Show file tree
Hide file tree
Showing 42 changed files with 411 additions and 61 deletions.
3 changes: 1 addition & 2 deletions Language/Errors_and_Warnings/compile_error_lib_p2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
// 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.


part of compile_error_part_lib;
part of 'compile_error_lib_p1.dart';

int f2() {
return 1;
Expand Down
3 changes: 1 addition & 2 deletions Language/Libraries_and_Scripts/Exports/invalid_uri_t03.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/// @assertion It is a compile-time error if the specified URI does not refer
/// to a library declaration.
///
/// @description Checks that it is a compile-time error when the resource
/// specified by the URI refers to a part declaration which is not a library
/// declaration
Expand All @@ -12,8 +13,6 @@
// [error line 1, column 1]
// [cfe] unspecified

library my_lib;

export "invalid_uri_t03_part.dart";
// ^
// [analyzer] unspecified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
// 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 compile-time error if the specified URI does not refer
/// to a library declaration.
///
/// @description Checks that it is a compile-time error when the resource
/// specified by the URI refers to a part declaration which is not a library
/// declaration
/// @author ilya
part of my_lib;
part of 'invalid_uri_t03.dart';

var foo = 'foo';
3 changes: 1 addition & 2 deletions Language/Libraries_and_Scripts/Imports/invalid_uri_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
/// @assertion An import specifies a URI x where the declaration of an imported
/// library is to be found. It is a compile-time error if the specified URI does
/// not refer to a library declaration.
///
/// @description Checks that it is a compile-time error if the URI in an import
/// directive refers to a part declaration which is not a library declaration.
/// @author ilya
// [error line 1, column 1]
// [cfe] unspecified

library my_lib;

import "invalid_uri_t01_part.dart";
// ^
// [analyzer] unspecified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
// 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 An import specifies a URI x where the declaration of an imported
/// library is to be found. It is a compile-time error if the specified URI does
/// not refer to a library declaration.
///
/// @description Checks that it is a compile-time error if the URI in an import
/// directive refers to a part declaration which is not a library declaration.
/// @author ilya
part of my_lib;
part of 'invalid_uri_t01.dart';

var foo = 'foo';
4 changes: 2 additions & 2 deletions Language/Libraries_and_Scripts/Scripts/library5.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// 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.

part of main_in_a_part;
part of 'top_level_main_t04.dart';

main() {
print('it works');
print('It works!');
}
4 changes: 1 addition & 3 deletions Language/Libraries_and_Scripts/Scripts/library6.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
// 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.

part of Library_with_all_directives;


part of 'syntax_t11.dart';
8 changes: 2 additions & 6 deletions Language/Libraries_and_Scripts/Scripts/syntax_t11.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@
/// libraryDefinition:
/// scriptTag? libraryName? importOrExport* partDirective* topLevelDefinition*
/// ;
/// @description Checks that a script is parsed without errors
/// if all allowed directives are present and in the correct order.
/// @description Checks that a script is parsed without errors if all allowed
/// directives are present and in the correct order.
/// @author vasya


library Library_with_all_directives;

export "library1.dart";

import 'library1.dart';
Expand Down
7 changes: 0 additions & 7 deletions Language/Libraries_and_Scripts/URIs/part.dart

This file was deleted.

10 changes: 5 additions & 5 deletions Language/Libraries_and_Scripts/URIs/syntax_t11.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not an error to use a multi-line string
/// literal as a URI in a part directive.
/// literal as an URI in a part directive.
/// @author rodionov

library SomeLibrary;
part """part.dart""";
import '../../../Utils/expect.dart';
part """syntax_t11_part.dart""";

main() {
new FooClass();
Expect.equals("syntax_t11_part.dart", id);
}
18 changes: 18 additions & 0 deletions Language/Libraries_and_Scripts/URIs/syntax_t11_part.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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 URIs are specified by means of string literals:
/// uri:
/// stringLiteral
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not an error to use a multi-line string
/// literal as an URI in a part directive.
/// @author sgrekhov22@gmail.com
part of 'syntax_t11.dart';

String id = "syntax_t11_part.dart";
9 changes: 5 additions & 4 deletions Language/Libraries_and_Scripts/URIs/syntax_t12.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not an error to use a raw string literal
/// as a URI in a part directive.
/// as an URI in a part directive.
/// @author rodionov
library SomeLibrary;
part r"part.dart";
import '../../../Utils/expect.dart';
part r"syntax_t12_part.dart";

main() {
new FooClass();
Expect.equals("syntax_t12_part.dart", id);
}
18 changes: 18 additions & 0 deletions Language/Libraries_and_Scripts/URIs/syntax_t12_part.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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 URIs are specified by means of string literals:
/// uri:
/// stringLiteral
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not an error to use a raw string literal
/// as an URI in a part directive.
/// @author sgrekhov22@gmail.com
part of 'syntax_t12.dart';

String id = "syntax_t12_part.dart";
9 changes: 5 additions & 4 deletions Language/Libraries_and_Scripts/URIs/syntax_t13.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not an error to use a raw string literal
/// as a URI in a part directive.
/// as an URI in a part directive.
/// @author rodionov
library SomeLibrary;
part r'''part.dart''';
import '../../../Utils/expect.dart';
part r'''syntax_t13_part.dart''';

main() {
new FooClass();
Expect.equals("syntax_t13_part.dart", id);
}
18 changes: 18 additions & 0 deletions Language/Libraries_and_Scripts/URIs/syntax_t13_part.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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 URIs are specified by means of string literals:
/// uri:
/// stringLiteral
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not an error to use a raw string literal
/// as an URI in a part directive.
/// @author sgrekhov22@gmail.com
part of 'syntax_t13.dart';

String id = "syntax_t13_part.dart";
7 changes: 4 additions & 3 deletions Language/Libraries_and_Scripts/URIs/syntax_t14.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not a compile-time error when the URI in a
/// part directive consists of two adjacent string literals instead of one.
/// @author rodionov
library SomeLibrary;
part "part" ".dart";
import '../../../Utils/expect.dart';
part "syntax_t14_part" ".dart";

main() {
new FooClass();
Expect.equals("syntax_t14_part.dart", id);
}
18 changes: 18 additions & 0 deletions Language/Libraries_and_Scripts/URIs/syntax_t14_part.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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 URIs are specified by means of string literals:
/// uri:
/// stringLiteral
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not a compile-time error when the URI in a
/// part directive consists of two adjacent string literals instead of one.
/// @author sgrekhov22@gmail.com
part of 'syntax_t14.dart';

String id = "syntax_t14_part.dart";
7 changes: 4 additions & 3 deletions Language/Libraries_and_Scripts/URIs/syntax_t15.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not a compile-time error when the URI in a
/// part directive consists of two adjacent multi-line string literals
/// instead of one.
/// @author rodionov
library SomeLibrary;
part '''part''' '''.dart''';
import '../../../Utils/expect.dart';
part '''syntax_t15_part''' '''.dart''';

main() {
new FooClass();
Expect.equals("syntax_t15_part.dart", id);
}
19 changes: 19 additions & 0 deletions Language/Libraries_and_Scripts/URIs/syntax_t15_part.dart
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 URIs are specified by means of string literals:
/// uri:
/// stringLiteral
/// ;
/// It is a compile-time error if the string literal x that describes a URI
/// is not a compile-time constant, or if x involves string interpolation.
///
/// @description Checks that it is not a compile-time error when the URI in a
/// part directive consists of two adjacent multi-line string literals
/// instead of one.
/// @author sgrekhov22@gmail.com
part of 'syntax_t15.dart';

String id = "syntax_t15_part.dart";
1 change: 1 addition & 0 deletions Language/Libraries_and_Scripts/definition_syntax_t04.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/// library begins with the word library (possibly prefaced with any applicable
/// metadata annotations), followed by a qualified identifier that gives the
/// name of the library.
///
/// @description Checks that it is a compile-error if a part directive comes
/// before the library name.
/// @author rodionov
Expand Down
22 changes: 22 additions & 0 deletions Language/Libraries_and_Scripts/definition_syntax_t04_lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
// 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 libraryDefinition:
/// scriptTag? libraryName? importOrExport* partDirective* topLevelDefinition*
/// ;
/// scriptTag:
/// ‘#!’ ( ̃NEWLINE)* NEWLINE
/// ;
/// libraryName:
/// metadata library identifier (‘.’ identifier)* ‘;’
/// ;
/// importOrExport:
/// libraryImport |
/// libraryExport
/// ;
/// Libraries may be explicitly named or implicitly named. An explicitly named
/// library begins with the word library (possibly prefaced with any applicable
/// metadata annotations), followed by a qualified identifier that gives the
/// name of the library.
///
/// @description Checks that it is a compile-error if a part directive comes
/// before the library name.
/// @author rodionov
part "definition_syntax_t04_lib_p1.dart";

/**/library Definition_Syntax_t04_lib;
Expand Down
24 changes: 23 additions & 1 deletion Language/Libraries_and_Scripts/definition_syntax_t04_lib_p1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,26 @@
// 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.

part of Definition_Syntax_t04_lib;
/// @assertion libraryDefinition:
/// scriptTag? libraryName? importOrExport* partDirective* topLevelDefinition*
/// ;
/// scriptTag:
/// ‘#!’ ( ̃NEWLINE)* NEWLINE
/// ;
/// libraryName:
/// metadata library identifier (‘.’ identifier)* ‘;’
/// ;
/// importOrExport:
/// libraryImport |
/// libraryExport
/// ;
/// Libraries may be explicitly named or implicitly named. An explicitly named
/// library begins with the word library (possibly prefaced with any applicable
/// metadata annotations), followed by a qualified identifier that gives the
/// name of the library.
///
/// @description Checks that it is a compile-error if a part directive comes
/// before the library name.
/// @author rodionov
part of 'definition_syntax_t04_lib.dart';
1 change: 1 addition & 0 deletions Language/Libraries_and_Scripts/definition_syntax_t07.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/// library begins with the word library (possibly prefaced with any applicable
/// metadata annotations), followed by a qualified identifier that gives the
/// name of the library.
///
/// @description Checks that it is a compile-error if a part directive
/// comes before an import directive.
/// @author msyabro
Expand Down
Loading

0 comments on commit e7fd9a9

Please sign in to comment.