Reproduction of dartbug.com/35715

Get an error saying something like
"The argument type 'dart.core::String' can't be assigned to
the parameter type 'dart.core::String'"

Change-Id: I327c613a2070495653e4089475a4f3edf550e9d4
Reviewed-on: https://dart-review.googlesource.com/c/91228
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
This commit is contained in:
Jens Johansen 2019-01-28 12:15:41 +00:00 committed by commit-bot@chromium.org
parent e169134203
commit 42be4083bd
3 changed files with 75 additions and 6 deletions

View file

@ -192,7 +192,8 @@ Future<Null> newWorldTest(bool strong, List worlds) async {
final List<int> sdkSummaryData =
await new File.fromUri(platformUri).readAsBytes();
List<int> newestWholeComponent;
List<int> newestWholeComponentData;
Component newestWholeComponent;
MemoryFileSystem fs;
Map<String, String> sourceFiles;
CompilerOptions options;
@ -208,8 +209,11 @@ Future<Null> newWorldTest(bool strong, List worlds) async {
}
fs.entityForUri(sdkSummary).writeAsBytesSync(sdkSummaryData);
bool expectInitializeFromDill = false;
if (newestWholeComponent != null && newestWholeComponent.isNotEmpty) {
fs.entityForUri(initializeFrom).writeAsBytesSync(newestWholeComponent);
if (newestWholeComponentData != null &&
newestWholeComponentData.isNotEmpty) {
fs
.entityForUri(initializeFrom)
.writeAsBytesSync(newestWholeComponentData);
expectInitializeFromDill = true;
}
if (world["expectInitializeFromDill"] != null) {
@ -256,7 +260,12 @@ Future<Null> newWorldTest(bool strong, List worlds) async {
Uri entry = base.resolve(world["entry"]);
if (brandNewWorld) {
compiler = new TestIncrementalCompiler(options, entry, initializeFrom);
if (world["fromComponent"] == true) {
compiler = new TestIncrementalCompiler.fromComponent(
options, entry, newestWholeComponent);
} else {
compiler = new TestIncrementalCompiler(options, entry, initializeFrom);
}
}
List<Uri> invalidated = new List<Uri>();
@ -275,7 +284,8 @@ Future<Null> newWorldTest(bool strong, List worlds) async {
world, gotError, formattedErrors, gotWarning, formattedWarnings);
util.throwOnEmptyMixinBodies(component);
print("Compile took ${stopwatch.elapsedMilliseconds} ms");
newestWholeComponent = serializeComponent(component);
newestWholeComponentData = serializeComponent(component);
newestWholeComponent = component;
print("*****\n\ncomponent:\n${componentToString(component)}\n\n\n");
if (component.libraries.length != world["expectedLibraryCount"]) {
throw "Expected ${world["expectedLibraryCount"]} libraries, "
@ -316,7 +326,7 @@ Future<Null> newWorldTest(bool strong, List worlds) async {
world, gotError, formattedErrors, gotWarning, formattedWarnings);
List<int> thisWholeComponent = serializeComponent(component2);
print("*****\n\ncomponent2:\n${componentToString(component2)}\n\n\n");
checkIsEqual(newestWholeComponent, thisWholeComponent);
checkIsEqual(newestWholeComponentData, thisWholeComponent);
}
}
}
@ -480,6 +490,13 @@ class TestIncrementalCompiler extends IncrementalCompiler {
new ProcessedOptions(options: options, inputs: [entryPoint])),
initializeFrom);
TestIncrementalCompiler.fromComponent(CompilerOptions options,
this.entryPoint, Component componentToInitializeFrom)
: super.fromComponent(
new CompilerContext(
new ProcessedOptions(options: options, inputs: [entryPoint])),
componentToInitializeFrom);
@override
void recordInvalidatedImportUrisForTesting(List<Uri> uris) {
invalidatedImportUrisForTesting = uris.isEmpty ? null : uris.toSet();

View file

@ -0,0 +1,50 @@
# Copyright (c) 2019, 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.md file.
# Initialize from component, where the component is linked to one sdk, and where
# the incremental compiler loads another sdk. Risk when doing this: Having two
# definitions of the same thing (e.g. the class 'String'), which could lead to
# errors such as "The argument type 'dart.core::String' can't be assigned to
# the parameter type 'dart.core::String'".
type: newworld
strong: true
worlds:
- entry: main.dart
errors: false
warnings: false
sources:
main.dart: |
import "b.dart";
main() {
useString("hello");
}
b.dart: |
import "dart:core";
void useString(String s) {
print("Hello from useString: $s");
}
expectedLibraryCount: 2
- entry: main.dart
errors: false
warnings: false
fromComponent: true
invalidate:
- main.dart
sources:
main.dart: |
import "b.dart";
main() {
useString("hello");
}
b.dart: |
import "dart:core";
void useString(String s) {
print("Hello from useString: $s");
}
expectedLibraryCount: 2

View file

@ -3,3 +3,5 @@
# BSD-style license that can be found in the LICENSE.md file.
# Status file for the test suite ../test/incremental_load_from_dill_yaml_test.dart.
load_from_component_explicitly_import_dart_core: Crash