Version 2.18.0-105.0.dev
Merge commit 'de3cec3a470951b9449f231f61284c5b4b123df5' into 'dev'
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 77c6eaa..53fa58e 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
@@ -2149,7 +2149,18 @@
/// 1. `_Named&S&M1`
/// 2. `_Named&S&M1&M2`
/// 3. `Named`.
- String runningName = extractName(supertype.name);
+ Object nameSourceForExtraction;
+ if (supertype.name == null) {
+ assert(supertype is FunctionTypeBuilder);
+
+ // Function types don't have names, and we can supply any string that
+ // doesn't have to be unique. The actual supertype of the mixin will
+ // not be built in that case.
+ nameSourceForExtraction = "";
+ } else {
+ nameSourceForExtraction = supertype.name!;
+ }
+ String runningName = extractName(nameSourceForExtraction);
/// True when we're building a named mixin application. Notice that for
/// the `Named` example above, this is only true on the last
@@ -5245,7 +5256,9 @@
declaration.charOffset, declaration.fileUri);
}
-String extractName(name) => name is QualifiedName ? name.name : name;
+String extractName(Object name) {
+ return name is QualifiedName ? name.name : name as String;
+}
class PostponedProblem {
final Message message;
diff --git a/pkg/front_end/testcases/general/issue48919.dart b/pkg/front_end/testcases/general/issue48919.dart
new file mode 100644
index 0000000..9bec7cc
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48919.dart
@@ -0,0 +1,8 @@
+// Copyright (c) 2022, 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.
+
+mixin M {}
+class A = void Function() with M;
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48919.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue48919.dart.textual_outline.expect
new file mode 100644
index 0000000..21a461f
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48919.dart.textual_outline.expect
@@ -0,0 +1,3 @@
+mixin M {}
+class A = void Function() with M;
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48919.dart.weak.expect b/pkg/front_end/testcases/general/issue48919.dart.weak.expect
new file mode 100644
index 0000000..ac31d73
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48919.dart.weak.expect
@@ -0,0 +1,19 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48919.dart:6:16: Error: Can't use a function type as supertype.
+// class A = void Function() with M;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M extends core::Object /*isMixinDeclaration*/ {
+}
+class A = core::Object with self::M /*hasConstConstructor*/ {
+ const synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48919.dart.weak.modular.expect b/pkg/front_end/testcases/general/issue48919.dart.weak.modular.expect
new file mode 100644
index 0000000..ac31d73
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48919.dart.weak.modular.expect
@@ -0,0 +1,19 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48919.dart:6:16: Error: Can't use a function type as supertype.
+// class A = void Function() with M;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M extends core::Object /*isMixinDeclaration*/ {
+}
+class A = core::Object with self::M /*hasConstConstructor*/ {
+ const synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48919.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue48919.dart.weak.outline.expect
new file mode 100644
index 0000000..10edd8f
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48919.dart.weak.outline.expect
@@ -0,0 +1,20 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48919.dart:6:16: Error: Can't use a function type as supertype.
+// class A = void Function() with M;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M extends core::Object /*isMixinDeclaration*/ {
+}
+class A = core::Object with self::M /*hasConstConstructor*/ {
+ const synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/issue48919.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue48919.dart.weak.transformed.expect
new file mode 100644
index 0000000..4683e8a
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48919.dart.weak.transformed.expect
@@ -0,0 +1,19 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48919.dart:6:16: Error: Can't use a function type as supertype.
+// class A = void Function() with M;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+abstract class M extends core::Object /*isMixinDeclaration*/ {
+}
+class A extends core::Object implements self::M /*isEliminatedMixin,hasConstConstructor*/ {
+ const synthetic constructor •() → self::A
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 259a964..7f8673a 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -98,6 +98,7 @@
general/issue47922: FormatterCrash
general/issue48487: FormatterCrash
general/issue48487b: FormatterCrash
+general/issue48919: FormatterCrash
general/issue_46886: FormatterCrash
general/macro_class: FormatterCrash
general/many_errors2: FormatterCrash
diff --git a/pkg/test_runner/lib/src/configuration.dart b/pkg/test_runner/lib/src/configuration.dart
index 92cf4a9..e6a0901 100644
--- a/pkg/test_runner/lib/src/configuration.dart
+++ b/pkg/test_runner/lib/src/configuration.dart
@@ -171,7 +171,7 @@
String _packages;
String get packages {
- // If the .packages file path wasn't given, find it.
+ // If the package config file path wasn't given, find it.
_packages ??=
Repository.uri.resolve('.dart_tool/package_config.json').toFilePath();
diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart
index d0a67e1..89d461b8 100644
--- a/pkg/test_runner/lib/src/options.dart
+++ b/pkg/test_runner/lib/src/options.dart
@@ -613,7 +613,10 @@
var value = data[name];
if (data[name] == option.defaultValue ||
(name == 'packages' &&
- value == Repository.uri.resolve('.packages').toFilePath())) {
+ value ==
+ Repository.uri
+ .resolve('.dart_tool/package_config.json')
+ .toFilePath())) {
continue;
}
@@ -634,8 +637,9 @@
// Only one value in the configuration map is mutable:
if (selectors.containsKey('observatory_ui')) {
if (selectors.length == 1) {
- configuration['packages'] =
- Repository.uri.resolve('.packages').toFilePath();
+ configuration['packages'] = Repository.uri
+ .resolve('.dart_tool/package_config.json')
+ .toFilePath();
} else {
// Make a new configuration whose selectors map only contains
// observatory_ui, and remove observatory_ui from the original
@@ -648,8 +652,9 @@
selectors.remove('observatory_ui');
// Set the packages flag.
- observatoryConfiguration['packages'] =
- Repository.uri.resolve('.packages').toFilePath();
+ observatoryConfiguration['packages'] = Repository.uri
+ .resolve('.dart_tool/package_config.json')
+ .toFilePath();
return [
..._expandConfigurations(configuration, selectors),
diff --git a/tests/language/const/map_hashcode_override_test.dart b/tests/language/const/map_hashcode_override_test.dart
index f8aa3cc..b9dd257 100644
--- a/tests/language/const/map_hashcode_override_test.dart
+++ b/tests/language/const/map_hashcode_override_test.dart
@@ -23,11 +23,14 @@
const Nasty(this.n);
int get hashCode {
- while (true) {}
+ throw "Evil hashCode";
}
}
main() {
+ // Test that when using an instance of a custom class as a key in a const Map,
+ // its hash code is computed as its identity hash, and even if the class
+ // overrides `hashCode`, that `hashCode` implementation is not called.
final map = const {1: 42, 'foo': 499, 2: 'bar', Nasty(1): 'baz'};
Expect.equals(42, map[getValueNonOptimized(1.0)]);
Expect.equals(
diff --git a/tests/language_2/const/map_hashcode_override_test.dart b/tests/language_2/const/map_hashcode_override_test.dart
index a696d36..6558b75 100644
--- a/tests/language_2/const/map_hashcode_override_test.dart
+++ b/tests/language_2/const/map_hashcode_override_test.dart
@@ -25,11 +25,14 @@
const Nasty(this.n);
int get hashCode {
- while (true) {}
+ throw "Evil hashCode";
}
}
main() {
+ // Test that when using an instance of a custom class as a key in a const Map,
+ // its hash code is computed as its identity hash, and even if the class
+ // overrides `hashCode`, that `hashCode` implementation is not called.
final map = const {1: 42, 'foo': 499, 2: 'bar', Nasty(1): 'baz'};
Expect.equals(42, map[getValueNonOptimized(1.0)]);
Expect.equals(
diff --git a/tools/VERSION b/tools/VERSION
index a3b581e..1d283ff 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 104
+PRERELEASE 105
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index b147a28..150f06f 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -113,28 +113,6 @@
},
);
writeIfDifferent(configFile, packageConfig.generateJson('..'));
-
- // Also generate the repo's .packages file.
- var packagesFile = File(join(repoRoot, '.packages'));
- var buffer = StringBuffer('''
-# Copyright (c) 2016, 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.
-#
-# This file is generated; do not edit. To re-generate, run:
-# 'dart tools/generate_package_config.dart'.
-
-''');
- for (var package in packages) {
- final name = package.name;
- final rootUri = package.rootUri;
- final packageUri = package.packageUri;
-
- if (packageUri != null && packageUri != '.nonexisting') {
- buffer.writeln('$name:${posix(rootUri)}/${posix(packageUri)}');
- }
- }
- writeIfDifferent(packagesFile, buffer.toString());
}
/// Writes the given [contents] string to [file] if the contents are different