Version 2.15.0-183.0.dev
Merge commit 'b683e9c481d2aee4443d08a9d15ae31a5216311a' into 'dev'
diff --git a/DEPS b/DEPS
index a567d7f..7bb539d 100644
--- a/DEPS
+++ b/DEPS
@@ -44,7 +44,7 @@
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
# hashes. It requires access to the dart-build-access group, which EngProd
# has.
- "co19_rev": "e9f3b0239dedd349084ca1e0b9d2ceacf4b2a1ef",
+ "co19_rev": "3f7916727cf025bdedbe2b49625a8c403bead66b",
# This line prevents conflicts when both packages are rolled simultaneously.
"co19_2_rev": "13344ad01472df9badfa78fd6aa411f042e13354",
diff --git a/pkg/front_end/lib/src/fasta/builder/constructor_builder.dart b/pkg/front_end/lib/src/fasta/builder/constructor_builder.dart
index cf6125b..c71dda4 100644
--- a/pkg/front_end/lib/src/fasta/builder/constructor_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/constructor_builder.dart
@@ -126,19 +126,24 @@
int charOffset,
this.charOpenParenOffset,
int charEndOffset,
- Member? referenceFrom,
+ Reference? constructorReference,
+ Reference? tearOffReference,
{String? nativeMethodName,
required bool forAbstractClassOrEnum})
: _constructor = new Constructor(new FunctionNode(null),
name: new Name(name, compilationUnit.library),
fileUri: compilationUnit.fileUri,
- reference: referenceFrom?.reference)
+ reference: constructorReference)
..startFileOffset = startCharOffset
..fileOffset = charOffset
..fileEndOffset = charEndOffset
..isNonNullableByDefault = compilationUnit.isNonNullableByDefault,
_constructorTearOff = createConstructorTearOffProcedure(
- name, compilationUnit, compilationUnit.fileUri, charOffset,
+ name,
+ compilationUnit,
+ compilationUnit.fileUri,
+ charOffset,
+ tearOffReference,
forAbstractClassOrEnum: forAbstractClassOrEnum),
super(metadata, modifiers, returnType, name, typeVariables, formals,
compilationUnit, charOffset, nativeMethodName);
diff --git a/pkg/front_end/lib/src/fasta/builder/enum_builder.dart b/pkg/front_end/lib/src/fasta/builder/enum_builder.dart
index 6f9fcec..0b293c4 100644
--- a/pkg/front_end/lib/src/fasta/builder/enum_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/enum_builder.dart
@@ -40,6 +40,7 @@
templateDuplicatedDeclarationSyntheticCause,
templateEnumConstantSameNameAsEnclosing;
+import '../kernel/constructor_tearoff_lowering.dart';
import '../kernel/kernel_helper.dart';
import '../util/helpers.dart';
@@ -198,14 +199,17 @@
? referencesFromIndexed.library.reference
: parent.library.reference);
- Constructor? constructorReference;
+ Reference? constructorReference;
+ Reference? tearOffReference;
Reference? toStringReference;
Reference? valuesFieldReference;
Reference? valuesGetterReference;
Reference? valuesSetterReference;
if (referencesFromIndexed != null) {
constructorReference =
- referencesFromIndexed.lookupConstructor(new Name("")) as Constructor;
+ referencesFromIndexed.lookupConstructorReference(new Name(""));
+ tearOffReference = referencesFromIndexed.lookupGetterReference(
+ constructorTearOffName("", referencesFromIndexed.library));
toStringReference =
referencesFromIndexed.lookupGetterReference(new Name("toString"));
Name valuesName = new Name("values");
@@ -235,6 +239,7 @@
charOffset,
charEndOffset,
constructorReference,
+ tearOffReference,
forAbstractClassOrEnum: true);
constructors[""] = constructorBuilder;
FieldBuilder valuesBuilder = new SourceFieldBuilder(
diff --git a/pkg/front_end/lib/src/fasta/builder/factory_builder.dart b/pkg/front_end/lib/src/fasta/builder/factory_builder.dart
index 2561223..5db68f5 100644
--- a/pkg/front_end/lib/src/fasta/builder/factory_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/factory_builder.dart
@@ -66,6 +66,7 @@
this.charOpenParenOffset,
int charEndOffset,
Reference? procedureReference,
+ Reference? tearOffReference,
AsyncMarker asyncModifier,
NameScheme nameScheme,
{String? nativeMethodName})
@@ -79,8 +80,8 @@
..fileOffset = charOffset
..fileEndOffset = charEndOffset
..isNonNullableByDefault = libraryBuilder.isNonNullableByDefault,
- _factoryTearOff = createFactoryTearOffProcedure(
- name, libraryBuilder, libraryBuilder.fileUri, charOffset),
+ _factoryTearOff = createFactoryTearOffProcedure(name, libraryBuilder,
+ libraryBuilder.fileUri, charOffset, tearOffReference),
super(metadata, modifiers, returnType, name, typeVariables, formals,
libraryBuilder, charOffset, nativeMethodName) {
this.asyncModifier = asyncModifier;
@@ -273,6 +274,7 @@
int charOpenParenOffset,
int charEndOffset,
Reference? procedureReference,
+ Reference? tearOffReference,
NameScheme nameScheme,
String? nativeMethodName,
this.redirectionTarget)
@@ -289,6 +291,7 @@
charOpenParenOffset,
charEndOffset,
procedureReference,
+ tearOffReference,
AsyncMarker.Sync,
nameScheme,
nativeMethodName: nativeMethodName);
diff --git a/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart b/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart
index d931f8e..e3dd8b1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constructor_tearoff_lowering.dart
@@ -97,8 +97,12 @@
/// the given [name] in [compilationUnit].
///
/// If constructor tear off lowering is not enabled, `null` is returned.
-Procedure? createConstructorTearOffProcedure(String name,
- SourceLibraryBuilder compilationUnit, Uri fileUri, int fileOffset,
+Procedure? createConstructorTearOffProcedure(
+ String name,
+ SourceLibraryBuilder compilationUnit,
+ Uri fileUri,
+ int fileOffset,
+ Reference? reference,
{required bool forAbstractClassOrEnum}) {
if (!forAbstractClassOrEnum &&
compilationUnit
@@ -107,7 +111,8 @@
compilationUnit,
constructorTearOffName(name, compilationUnit.library),
fileUri,
- fileOffset);
+ fileOffset,
+ reference);
}
return null;
}
@@ -116,15 +121,20 @@
/// the given [name] in [compilationUnit].
///
/// If constructor tear off lowering is not enabled, `null` is returned.
-Procedure? createFactoryTearOffProcedure(String name,
- SourceLibraryBuilder compilationUnit, Uri fileUri, int fileOffset) {
+Procedure? createFactoryTearOffProcedure(
+ String name,
+ SourceLibraryBuilder compilationUnit,
+ Uri fileUri,
+ int fileOffset,
+ Reference? reference) {
if (compilationUnit
.loader.target.backendTarget.isFactoryTearOffLoweringEnabled) {
return _createTearOffProcedure(
compilationUnit,
constructorTearOffName(name, compilationUnit.library),
fileUri,
- fileOffset);
+ fileOffset,
+ reference);
}
return null;
}
@@ -132,13 +142,19 @@
/// Creates the [Procedure] for the lowering of a typedef tearoff of a
/// constructor of the given [name] in with the typedef defined in
/// [libraryBuilder].
-Procedure createTypedefTearOffProcedure(String typedefName, String name,
- SourceLibraryBuilder libraryBuilder, Uri fileUri, int fileOffset) {
+Procedure createTypedefTearOffProcedure(
+ String typedefName,
+ String name,
+ SourceLibraryBuilder libraryBuilder,
+ Uri fileUri,
+ int fileOffset,
+ Reference? reference) {
return _createTearOffProcedure(
libraryBuilder,
typedefTearOffName(typedefName, name, libraryBuilder.library),
fileUri,
- fileOffset);
+ fileOffset,
+ reference);
}
/// Creates the parameters and body for [tearOff] based on [constructor] in
@@ -307,9 +323,9 @@
/// Creates the synthesized [Procedure] node for a tear off lowering by the
/// given [name].
Procedure _createTearOffProcedure(SourceLibraryBuilder libraryBuilder,
- Name name, Uri fileUri, int fileOffset) {
+ Name name, Uri fileUri, int fileOffset, Reference? reference) {
return new Procedure(name, ProcedureKind.Method, new FunctionNode(null),
- fileUri: fileUri, isStatic: true)
+ fileUri: fileUri, isStatic: true, reference: reference)
..startFileOffset = fileOffset
..fileOffset = fileOffset
..fileEndOffset = fileOffset
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 1600030..91a86f3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -773,10 +773,13 @@
}
IndexedClass? indexedClass = builder.referencesFromIndexed;
- Constructor? referenceFrom;
+ Reference? constructorReference;
+ Reference? tearOffReference;
if (indexedClass != null) {
- referenceFrom =
- indexedClass.lookupConstructor(new Name("")) as Constructor?;
+ constructorReference =
+ indexedClass.lookupConstructorReference(new Name(""));
+ tearOffReference = indexedClass.lookupGetterReference(
+ constructorTearOffName("", indexedClass.library));
}
/// From [Dart Programming Language Specification, 4th Edition](
@@ -784,8 +787,8 @@
/// >Iff no constructor is specified for a class C, it implicitly has a
/// >default constructor C() : super() {}, unless C is class Object.
// The superinitializer is installed below in [finishConstructors].
- builder.addSyntheticConstructor(
- _makeDefaultConstructor(builder, referenceFrom));
+ builder.addSyntheticConstructor(_makeDefaultConstructor(
+ builder, constructorReference, tearOffReference));
}
void installForwardingConstructors(SourceClassBuilder builder) {
@@ -828,10 +831,13 @@
}
IndexedClass? indexedClass = builder.referencesFromIndexed;
- Constructor? referenceFrom;
+ Reference? constructorReference;
+ Reference? tearOffReference;
if (indexedClass != null) {
- referenceFrom =
- indexedClass.lookupConstructor(new Name("")) as Constructor?;
+ constructorReference =
+ indexedClass.lookupConstructorReference(new Name(""));
+ tearOffReference = indexedClass.lookupGetterReference(
+ constructorTearOffName("", indexedClass.library));
}
if (supertype is ClassBuilder) {
@@ -842,14 +848,21 @@
void addSyntheticConstructor(String name, MemberBuilder memberBuilder) {
if (memberBuilder.member is Constructor) {
substitutionMap ??= builder.getSubstitutionMap(superclassBuilder.cls);
- Constructor? referenceFrom = indexedClass?.lookupConstructor(
- new Name(name, indexedClass.library)) as Constructor?;
+ Reference? constructorReference;
+ Reference? tearOffReference;
+ if (indexedClass != null) {
+ constructorReference = indexedClass.lookupConstructorReference(
+ new Name(name, indexedClass.library));
+ tearOffReference = indexedClass.lookupGetterReference(
+ constructorTearOffName(name, indexedClass.library));
+ }
builder.addSyntheticConstructor(_makeMixinApplicationConstructor(
builder,
builder.cls.mixin,
memberBuilder as MemberBuilderImpl,
substitutionMap!,
- referenceFrom));
+ constructorReference,
+ tearOffReference));
isConstructorAdded = true;
}
}
@@ -858,16 +871,16 @@
includeInjectedConstructors: true);
if (!isConstructorAdded) {
- builder.addSyntheticConstructor(
- _makeDefaultConstructor(builder, referenceFrom));
+ builder.addSyntheticConstructor(_makeDefaultConstructor(
+ builder, constructorReference, tearOffReference));
}
} else if (supertype is InvalidTypeDeclarationBuilder ||
supertype is TypeVariableBuilder ||
supertype is DynamicTypeDeclarationBuilder ||
supertype is VoidTypeDeclarationBuilder ||
supertype is NeverTypeDeclarationBuilder) {
- builder.addSyntheticConstructor(
- _makeDefaultConstructor(builder, referenceFrom));
+ builder.addSyntheticConstructor(_makeDefaultConstructor(
+ builder, constructorReference, tearOffReference));
} else {
unhandled("${supertype.runtimeType}", "installForwardingConstructors",
builder.charOffset, builder.fileUri);
@@ -879,7 +892,8 @@
Class mixin,
MemberBuilderImpl superConstructorBuilder,
Map<TypeParameter, DartType> substitutionMap,
- Constructor? referenceFrom) {
+ Reference? constructorReference,
+ Reference? tearOffReference) {
bool hasTypeDependency = false;
Substitution substitution = Substitution.fromMap(substitutionMap);
@@ -950,7 +964,7 @@
initializers: <Initializer>[initializer],
isSynthetic: true,
isConst: isConst,
- reference: referenceFrom?.reference,
+ reference: constructorReference,
fileUri: cls.fileUri)
// TODO(johnniwinther): Should we add file offsets to synthesized
// constructors?
@@ -970,6 +984,7 @@
classBuilder.library,
cls.fileUri,
cls.fileOffset,
+ tearOffReference,
forAbstractClassOrEnum: classBuilder.isAbstract);
if (constructorTearOff != null) {
@@ -996,14 +1011,16 @@
}
SyntheticConstructorBuilder _makeDefaultConstructor(
- SourceClassBuilder classBuilder, Constructor? referenceFrom) {
+ SourceClassBuilder classBuilder,
+ Reference? constructorReference,
+ Reference? tearOffReference) {
Class enclosingClass = classBuilder.cls;
Constructor constructor = new Constructor(
new FunctionNode(new EmptyStatement(),
returnType: makeConstructorReturnType(enclosingClass)),
name: new Name(""),
isSynthetic: true,
- reference: referenceFrom?.reference,
+ reference: constructorReference,
fileUri: enclosingClass.fileUri)
..fileOffset = enclosingClass.fileOffset
// TODO(johnniwinther): Should we add file end offsets to synthesized
@@ -1011,8 +1028,12 @@
//..fileEndOffset = enclosingClass.fileOffset
..isNonNullableByDefault =
enclosingClass.enclosingLibrary.isNonNullableByDefault;
- Procedure? constructorTearOff = createConstructorTearOffProcedure('',
- classBuilder.library, enclosingClass.fileUri, enclosingClass.fileOffset,
+ Procedure? constructorTearOff = createConstructorTearOffProcedure(
+ '',
+ classBuilder.library,
+ enclosingClass.fileUri,
+ enclosingClass.fileOffset,
+ tearOffReference,
forAbstractClassOrEnum:
enclosingClass.isAbstract || enclosingClass.isEnum);
if (constructorTearOff != null) {
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index b046570..f1cb153 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -82,6 +82,7 @@
import '../import.dart' show Import;
import '../kernel/class_hierarchy_builder.dart';
+import '../kernel/constructor_tearoff_lowering.dart';
import '../kernel/implicit_field_type.dart';
import '../kernel/internal_ast.dart';
import '../kernel/load_library_builder.dart';
@@ -2352,10 +2353,14 @@
String? nativeMethodName,
{Token? beginInitializers,
required bool forAbstractClass}) {
- Member? referenceFrom;
+ Reference? constructorReference;
+ Reference? tearOffReference;
if (_currentClassReferencesFromIndexed != null) {
- referenceFrom = _currentClassReferencesFromIndexed!.lookupConstructor(
- new Name(
+ constructorReference = _currentClassReferencesFromIndexed!
+ .lookupConstructorReference(new Name(
+ constructorName, _currentClassReferencesFromIndexed!.library));
+ tearOffReference = _currentClassReferencesFromIndexed!
+ .lookupGetterReference(constructorTearOffName(
constructorName, _currentClassReferencesFromIndexed!.library));
}
ConstructorBuilder constructorBuilder = new SourceConstructorBuilder(
@@ -2370,12 +2375,14 @@
charOffset,
charOpenParenOffset,
charEndOffset,
- referenceFrom,
+ constructorReference,
+ tearOffReference,
nativeMethodName: nativeMethodName,
forAbstractClassOrEnum: forAbstractClass);
checkTypeVariables(typeVariables, constructorBuilder);
+ // TODO(johnniwinther): There is no way to pass the tear off reference here.
addBuilder(constructorName, constructorBuilder, charOffset,
- getterReference: referenceFrom?.reference);
+ getterReference: constructorReference);
if (nativeMethodName != null) {
addNativeMethod(constructorBuilder);
}
@@ -2538,10 +2545,16 @@
.reference
: library.reference);
- Reference? reference = _currentClassReferencesFromIndexed
- ?.lookupConstructor(new Name(
- procedureName, _currentClassReferencesFromIndexed!.library))
- ?.reference;
+ Reference? constructorReference;
+ Reference? tearOffReference;
+ if (_currentClassReferencesFromIndexed != null) {
+ constructorReference = _currentClassReferencesFromIndexed!
+ .lookupConstructorReference(new Name(
+ procedureName, _currentClassReferencesFromIndexed!.library));
+ tearOffReference = _currentClassReferencesFromIndexed!
+ .lookupGetterReference(constructorTearOffName(
+ procedureName, _currentClassReferencesFromIndexed!.library));
+ }
SourceFactoryBuilder procedureBuilder;
if (redirectionTarget != null) {
@@ -2560,7 +2573,8 @@
charOffset,
charOpenParenOffset,
charEndOffset,
- reference,
+ constructorReference,
+ tearOffReference,
procedureNameScheme,
nativeMethodName,
redirectionTarget);
@@ -2580,7 +2594,8 @@
charOffset,
charOpenParenOffset,
charEndOffset,
- reference,
+ constructorReference,
+ tearOffReference,
asyncModifier,
procedureNameScheme,
nativeMethodName: nativeMethodName);
@@ -2598,7 +2613,7 @@
factoryDeclaration.resolveTypes(procedureBuilder.typeVariables, this);
addBuilder(procedureName, procedureBuilder, charOffset,
- getterReference: reference);
+ getterReference: constructorReference);
if (nativeMethodName != null) {
addNativeMethod(procedureBuilder);
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
index bde992e..ea9bb01 100644
--- a/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_type_alias_builder.dart
@@ -320,9 +320,16 @@
}
Name targetName =
new Name(constructorName, declaration.library.library);
+ Reference? tearOffReference;
+ if (library.referencesFromIndexed != null) {
+ tearOffReference = library.referencesFromIndexed!
+ .lookupGetterReference(typedefTearOffName(name, constructorName,
+ library.referencesFromIndexed!.library));
+ }
+
Procedure tearOff = tearOffs![targetName] =
createTypedefTearOffProcedure(name, constructorName, library,
- target.fileUri, target.fileOffset);
+ target.fileUri, target.fileOffset, tearOffReference);
_tearOffDependencies![tearOff] = target;
buildTypedefTearOffProcedure(tearOff, target, declaration.cls,
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index 4275910..2cda1e4 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -73,6 +73,8 @@
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show KernelTarget;
+import 'package:front_end/src/fasta/kernel/utils.dart' show ByteSink;
+
import 'package:front_end/src/fasta/messages.dart' show LocatedMessage;
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
@@ -108,6 +110,8 @@
Visitor,
VisitorVoidMixin;
+import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
+
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
import 'package:kernel/core_types.dart' show CoreTypes;
@@ -1114,6 +1118,7 @@
..experimentEnabledVersionForTesting = experimentEnabledVersion
..experimentReleasedVersionForTesting = experimentReleasedVersion
..skipPlatformVerification = true
+ ..omitPlatform = true
..target = createTarget(folderOptions, context);
if (folderOptions.overwriteCurrentSdkVersion != null) {
compilerOptions.currentSdkVersion =
@@ -1204,6 +1209,10 @@
new IncrementalCompiler.fromComponent(
new CompilerContext(compilationSetup.options), platform);
final Component component = await incrementalCompiler.computeDelta();
+ if (!canSerialize(component)) {
+ return new Result<ComponentResult>(result, semiFuzzFailure,
+ "Couldn't serialize initial component for fuzzing");
+ }
final Set<Uri> userLibraries =
createUserLibrariesImportUriSet(component, uriTranslator);
@@ -1231,6 +1240,10 @@
incrementalCompiler.invalidate(importUri);
final Component newComponent =
await incrementalCompiler.computeDelta(fullComponent: true);
+ if (!canSerialize(newComponent)) {
+ return new Result<ComponentResult>(
+ result, semiFuzzFailure, "Couldn't serialize fuzzed component");
+ }
final Set<Uri> newUserLibraries =
createUserLibrariesImportUriSet(newComponent, uriTranslator);
@@ -1285,6 +1298,17 @@
return null;
}
+ bool canSerialize(Component component) {
+ ByteSink byteSink = new ByteSink();
+ try {
+ new BinaryPrinter(byteSink).writeComponentFile(component);
+ return true;
+ } catch (e, st) {
+ print("Can't serialize, got '$e' from $st");
+ return false;
+ }
+ }
+
/// Perform a number of compilations where each user-file is in turn sorted
/// in both ascending and descending order (i.e. the procedures and classes
/// etc are sorted).
@@ -1306,7 +1330,11 @@
IncrementalCompiler incrementalCompiler =
new IncrementalCompiler.fromComponent(
new CompilerContext(compilationSetup.options), platform);
- await incrementalCompiler.computeDelta();
+ Component initialComponent = await incrementalCompiler.computeDelta();
+ if (!canSerialize(initialComponent)) {
+ return new Result<ComponentResult>(result, semiFuzzFailure,
+ "Couldn't serialize initial component for fuzzing");
+ }
final bool expectErrors = compilationSetup.errors.isNotEmpty;
List<Iterable<String>> originalErrors =
@@ -1365,7 +1393,11 @@
incrementalCompiler = new IncrementalCompiler.fromComponent(
new CompilerContext(compilationSetup.options), platform);
try {
- await incrementalCompiler.computeDelta();
+ Component component = await incrementalCompiler.computeDelta();
+ if (!canSerialize(component)) {
+ return new Result<ComponentResult>(
+ result, semiFuzzFailure, "Couldn't serialize fuzzed component");
+ }
} catch (e, st) {
return new Result<ComponentResult>(
result,
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 82edba1..6beac94 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -459,6 +459,7 @@
futu
futures
fuzz
+fuzzed
fuzzing
fx
g1a
diff --git a/pkg/front_end/testcases/incremental/constructor_change.yaml b/pkg/front_end/testcases/incremental/constructor_change.yaml
new file mode 100644
index 0000000..58e4c05
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/constructor_change.yaml
@@ -0,0 +1,79 @@
+# Copyright (c) 2021, 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.
+
+# Compile an application, change a file, but don't change the outline.
+# Try to mess up the hierarchy.
+
+type: newworld
+target: DDC
+worlds:
+ - entry: main.dart
+ experiments: alternative-invalidation-strategy
+ sources:
+ main.dart: |
+ import "lib1.dart";
+ import "lib2.dart";
+ import "lib3.dart";
+
+ main() {
+ Foo foo = new Bar();
+ lib3Method(foo);
+ }
+ lib1.dart: |
+ class Foo {
+ void fooMethod() {
+ // Not filled out.
+ }
+ }
+ lib2.dart: |
+ import "lib1.dart";
+ class Bar extends Foo {
+ void barMethod() {
+ // Not filled out.
+ }
+ }
+ lib3.dart: |
+ import "lib1.dart";
+ import "lib2.dart";
+ void lib3Method(Foo foo) {
+ var f = Bar.new;
+ Foo bar = f();
+ bool equal = foo == bar;
+ print("foo == bar = $equal");
+ }
+ expectedLibraryCount: 4
+ - entry: main.dart
+ experiments: alternative-invalidation-strategy
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - lib1.dart
+ sources:
+ lib1.dart: |
+ class Foo {
+ void fooMethod() {
+ print("fooMethod");
+ }
+ }
+ expectedLibraryCount: 4
+ expectsRebuildBodiesOnly: true
+ - entry: main.dart
+ experiments: alternative-invalidation-strategy
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - lib3.dart
+ sources:
+ lib3.dart: |
+ import "lib1.dart";
+ import "lib2.dart";
+ void lib3Method(Foo foo) {
+ var f = Bar.new;
+ Foo bar = f();
+ bool equal = foo == bar;
+ print("foo == bar = $equal");
+ print("Done!");
+ }
+ expectedLibraryCount: 4
+ expectsRebuildBodiesOnly: true
diff --git a/pkg/front_end/testcases/incremental/constructor_change.yaml.world.1.expect b/pkg/front_end/testcases/incremental/constructor_change.yaml.world.1.expect
new file mode 100644
index 0000000..3885ee0
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/constructor_change.yaml.world.1.expect
@@ -0,0 +1,51 @@
+main = main::main;
+library from "org-dartlang-test:///lib1.dart" as lib1 {
+
+ class Foo extends dart.core::Object {
+ synthetic constructor •() → lib1::Foo
+ : super dart.core::Object::•()
+ ;
+ method fooMethod() → void {}
+ static method _#new#tearOff() → lib1::Foo
+ return new lib1::Foo::•();
+ }
+}
+library from "org-dartlang-test:///lib2.dart" as lib2 {
+
+ import "org-dartlang-test:///lib1.dart";
+
+ class Bar extends lib1::Foo {
+ synthetic constructor •() → lib2::Bar
+ : super lib1::Foo::•()
+ ;
+ method barMethod() → void {}
+ static method _#new#tearOff() → lib2::Bar
+ return new lib2::Bar::•();
+ }
+}
+library from "org-dartlang-test:///lib3.dart" as lib3 {
+
+ import "org-dartlang-test:///lib1.dart";
+ import "org-dartlang-test:///lib2.dart";
+
+ static method lib3Method(lib1::Foo foo) → void {
+ () → lib2::Bar f = #C1;
+ lib1::Foo bar = f(){() → lib2::Bar};
+ dart.core::bool equal = foo =={dart.core::Object::==}{(dart.core::Object) → dart.core::bool} bar;
+ dart.core::print("foo == bar = ${equal}");
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib1.dart";
+ import "org-dartlang-test:///lib2.dart";
+ import "org-dartlang-test:///lib3.dart";
+
+ static method main() → dynamic {
+ lib1::Foo foo = new lib2::Bar::•();
+ lib3::lib3Method(foo);
+ }
+}
+constants {
+ #C1 = static-tearoff lib2::Bar::_#new#tearOff
+}
diff --git a/pkg/front_end/testcases/incremental/constructor_change.yaml.world.2.expect b/pkg/front_end/testcases/incremental/constructor_change.yaml.world.2.expect
new file mode 100644
index 0000000..8b4f83e
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/constructor_change.yaml.world.2.expect
@@ -0,0 +1,53 @@
+main = main::main;
+library from "org-dartlang-test:///lib1.dart" as lib1 {
+
+ class Foo extends dart.core::Object {
+ synthetic constructor •() → lib1::Foo
+ : super dart.core::Object::•()
+ ;
+ method fooMethod() → void {
+ dart.core::print("fooMethod");
+ }
+ static method _#new#tearOff() → lib1::Foo
+ return new lib1::Foo::•();
+ }
+}
+library from "org-dartlang-test:///lib2.dart" as lib2 {
+
+ import "org-dartlang-test:///lib1.dart";
+
+ class Bar extends lib1::Foo {
+ synthetic constructor •() → lib2::Bar
+ : super lib1::Foo::•()
+ ;
+ method barMethod() → void {}
+ static method _#new#tearOff() → lib2::Bar
+ return new lib2::Bar::•();
+ }
+}
+library from "org-dartlang-test:///lib3.dart" as lib3 {
+
+ import "org-dartlang-test:///lib1.dart";
+ import "org-dartlang-test:///lib2.dart";
+
+ static method lib3Method(lib1::Foo foo) → void {
+ () → lib2::Bar f = #C1;
+ lib1::Foo bar = f(){() → lib2::Bar};
+ dart.core::bool equal = foo =={dart.core::Object::==}{(dart.core::Object) → dart.core::bool} bar;
+ dart.core::print("foo == bar = ${equal}");
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib1.dart";
+ import "org-dartlang-test:///lib2.dart";
+ import "org-dartlang-test:///lib3.dart";
+
+ static method main() → dynamic {
+ lib1::Foo foo = new lib2::Bar::•();
+ lib3::lib3Method(foo);
+ }
+}
+constants {
+ #C1 = static-tearoff lib2::Bar::_#new#tearOff
+}
diff --git a/pkg/front_end/testcases/incremental/constructor_change.yaml.world.3.expect b/pkg/front_end/testcases/incremental/constructor_change.yaml.world.3.expect
new file mode 100644
index 0000000..3436a8d
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/constructor_change.yaml.world.3.expect
@@ -0,0 +1,54 @@
+main = main::main;
+library from "org-dartlang-test:///lib1.dart" as lib1 {
+
+ class Foo extends dart.core::Object {
+ synthetic constructor •() → lib1::Foo
+ : super dart.core::Object::•()
+ ;
+ method fooMethod() → void {
+ dart.core::print("fooMethod");
+ }
+ static method _#new#tearOff() → lib1::Foo
+ return new lib1::Foo::•();
+ }
+}
+library from "org-dartlang-test:///lib2.dart" as lib2 {
+
+ import "org-dartlang-test:///lib1.dart";
+
+ class Bar extends lib1::Foo {
+ synthetic constructor •() → lib2::Bar
+ : super lib1::Foo::•()
+ ;
+ method barMethod() → void {}
+ static method _#new#tearOff() → lib2::Bar
+ return new lib2::Bar::•();
+ }
+}
+library from "org-dartlang-test:///lib3.dart" as lib3 {
+
+ import "org-dartlang-test:///lib1.dart";
+ import "org-dartlang-test:///lib2.dart";
+
+ static method lib3Method(lib1::Foo foo) → void {
+ () → lib2::Bar f = #C1;
+ lib1::Foo bar = f(){() → lib2::Bar};
+ dart.core::bool equal = foo =={dart.core::Object::==}{(dart.core::Object) → dart.core::bool} bar;
+ dart.core::print("foo == bar = ${equal}");
+ dart.core::print("Done!");
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///lib1.dart";
+ import "org-dartlang-test:///lib2.dart";
+ import "org-dartlang-test:///lib3.dart";
+
+ static method main() → dynamic {
+ lib1::Foo foo = new lib2::Bar::•();
+ lib3::lib3Method(foo);
+ }
+}
+constants {
+ #C1 = static-tearoff lib2::Bar::_#new#tearOff
+}
diff --git a/pkg/kernel/lib/reference_from_index.dart b/pkg/kernel/lib/reference_from_index.dart
index 6182a4b..47c7260 100644
--- a/pkg/kernel/lib/reference_from_index.dart
+++ b/pkg/kernel/lib/reference_from_index.dart
@@ -9,7 +9,6 @@
Extension,
Field,
Library,
- Member,
Name,
Procedure,
ProcedureKind,
@@ -116,19 +115,19 @@
class IndexedClass extends IndexedContainer {
final Class cls;
- final Map<Name, Member> _constructors = new Map<Name, Member>();
+ final Map<Name, Reference> _constructors = new Map<Name, Reference>();
@override
final Library library;
IndexedClass._(this.cls, this.library) {
for (int i = 0; i < cls.constructors.length; i++) {
Constructor constructor = cls.constructors[i];
- _constructors[constructor.name] = constructor;
+ _constructors[constructor.name] = constructor.reference;
}
for (int i = 0; i < cls.procedures.length; i++) {
Procedure procedure = cls.procedures[i];
if (procedure.isFactory) {
- _constructors[procedure.name] = procedure;
+ _constructors[procedure.name] = procedure.reference;
} else {
_addProcedure(procedure);
}
@@ -136,5 +135,5 @@
_addFields(cls.fields);
}
- Member? lookupConstructor(Name name) => _constructors[name];
+ Reference? lookupConstructorReference(Name name) => _constructors[name];
}
diff --git a/pkg/vm/lib/transformations/ffi_definitions.dart b/pkg/vm/lib/transformations/ffi_definitions.dart
index b0aa9a5..29b58fc 100644
--- a/pkg/vm/lib/transformations/ffi_definitions.dart
+++ b/pkg/vm/lib/transformations/ffi_definitions.dart
@@ -526,7 +526,7 @@
"#typedDataBase",
type: coreTypes.objectNonNullableRawType);
final name = Name("#fromTypedDataBase");
- final referenceFrom = indexedClass?.lookupConstructor(name);
+ final reference = indexedClass?.lookupConstructorReference(name);
final Constructor ctor = Constructor(
FunctionNode(EmptyStatement(),
positionalParameters: [typedDataBase],
@@ -540,7 +540,7 @@
Arguments([VariableGet(typedDataBase)]))
],
fileUri: node.fileUri,
- reference: referenceFrom?.reference)
+ reference: reference)
..fileOffset = node.fileOffset
..isNonNullableByDefault = node.enclosingLibrary.isNonNullableByDefault;
diff --git a/tools/VERSION b/tools/VERSION
index 438cf7b..ca28cda 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 182
+PRERELEASE 183
PRERELEASE_PATCH 0
\ No newline at end of file