Make importing two libraries with the same name a warning
Bug: https://github.com/dart-lang/sdk/issues/34612
Change-Id: I2697b56fb02d6bee8ea3bc2d06329100e287ae34
Reviewed-on: https://dart-review.googlesource.com/c/78242
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index 823177d..9f7d6bc 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -2393,7 +2393,8 @@
const Code<Message Function(String name)> codeDuplicatedLibraryImport =
const Code<Message Function(String name)>(
"DuplicatedLibraryImport", templateDuplicatedLibraryImport,
- analyzerCodes: <String>["IMPORT_DUPLICATED_LIBRARY_NAMED"]);
+ analyzerCodes: <String>["IMPORT_DUPLICATED_LIBRARY_NAMED"],
+ severity: Severity.warning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsDuplicatedLibraryImport(String name) {
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index dfe99df..bd7629e 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -1687,6 +1687,7 @@
DuplicatedLibraryImport:
template: "A library with name '#name' is imported more than once."
+ severity: WARNING
analyzerCode: IMPORT_DUPLICATED_LIBRARY_NAMED
script:
lib1.dart: "library foo;"
diff --git a/tests/co19_2/co19_2-kernel.status b/tests/co19_2/co19_2-kernel.status
index 11c39bb..ab9fc60 100644
--- a/tests/co19_2/co19_2-kernel.status
+++ b/tests/co19_2/co19_2-kernel.status
@@ -183,6 +183,7 @@
Language/Generics/syntax_t02: CompileTimeError
Language/Generics/syntax_t03: CompileTimeError
Language/Generics/upper_bound_t01: MissingCompileTimeError # Issue 33308
+Language/Libraries_and_Scripts/Imports/library_name_t01: MissingCompileTimeError # Expects an error, but this is a warning in Dart 2
Language/Mixins/Mixin_Application/deferred_t01: MissingCompileTimeError # Issue 30273
Language/Mixins/Mixin_Application/static_warning_t01: MissingCompileTimeError # Mixin super equirement
Language/Mixins/Mixin_Application/superclass_t01: MissingCompileTimeError
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index d510bbc..b39dc5f4f 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -25,7 +25,6 @@
inference/swarm_test: Slow, Pass, Fail #
inference/type_mask2_test: RuntimeError # Issue 34095
inlining/inlining_test: Slow, Pass
-model/in_user_code_test: RuntimeError # Two libraries with the same name -- actually a CompileTimeError
model/native_test: Pass, Slow
model/no_such_method_enabled_test: Pass, Slow
model/subtype_test: Pass, Slow
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index 963e273..04c296a 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -26,7 +26,6 @@
html/*: Skip # TODO(ahe): Make dart:html available.
isolate/browser/*: Skip # TODO(ahe): Make dart:html available.
js/*: Skip # TODO(ahe): Make dart:js available.
-mirrors/repeated_private_anon_mixin_app_test: CompileTimeError # Two libraries with same name inported.
[ $fasta ]
mirrors/deferred_constraints_constants_test/default_argument2: MissingCompileTimeError
@@ -206,7 +205,7 @@
mirrors/relation_assignable_test: RuntimeError
mirrors/relation_subclass_test: RuntimeError
mirrors/relation_subtype_test: RuntimeError
-mirrors/repeated_private_anon_mixin_app_test: CompileTimeError # Two libraries with same name inported.
+mirrors/repeated_private_anon_mixin_app_test: RuntimeError # Mangled mixin application class name
mirrors/static_members_easier_test: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/static_members_test: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/symbol_validation_test/01: RuntimeError # Issue 31537