Version 2.18.0-37.0.dev
Merge commit 'bf5aa0603d3c2907838fa42954e2582f5b31b9c1' into 'dev'
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index af89434..a5fac56 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -773,8 +773,7 @@
}
JumpTarget createJumpTarget(JumpTargetKind kind, int charOffset) {
- return new JumpTarget(
- kind, functionNestingLevel, member as MemberBuilder, charOffset);
+ return new JumpTarget(kind, functionNestingLevel, uri, charOffset);
}
void inferAnnotations(TreeNode? parent, List<Expression>? annotations) {
@@ -6177,6 +6176,9 @@
fasta.messageForInLoopWithConstVariable,
lvalue.fileOffset,
lvalue.name!.length);
+ // As a recovery step, remove the const flag, to not confuse the
+ // constant evaluator further in the pipeline.
+ lvalue.isConst = false;
}
} else {
VariableDeclaration variable = elements.syntheticVariableDeclaration =
@@ -6308,8 +6310,8 @@
List<Label>? labels = const FixedNullableList<Label>()
.popNonNullable(stack, labelCount, dummyLabel);
enterLocalScope('labeledStatement', scope.createNestedLabelScope());
- LabelTarget target = new LabelTarget(
- member as MemberBuilder, functionNestingLevel, token.charOffset);
+ LabelTarget target =
+ new LabelTarget(functionNestingLevel, uri, token.charOffset);
if (labels != null) {
for (Label label in labels) {
scope.declareLabel(label.name, target);
@@ -7490,14 +7492,12 @@
final int functionNestingLevel;
- final MemberBuilder parent;
+ final Uri fileUri;
final int charOffset;
JumpTarget(
- this.kind, this.functionNestingLevel, this.parent, this.charOffset);
-
- Uri get fileUri => parent.fileUri!;
+ this.kind, this.functionNestingLevel, this.fileUri, this.charOffset);
bool get isBreakTarget => kind == JumpTargetKind.Break;
@@ -7560,9 +7560,6 @@
}
class LabelTarget implements JumpTarget {
- @override
- final MemberBuilder parent;
-
final JumpTarget breakTarget;
final JumpTarget continueTarget;
@@ -7571,16 +7568,16 @@
final int functionNestingLevel;
@override
- final int charOffset;
-
- LabelTarget(this.parent, this.functionNestingLevel, this.charOffset)
- : breakTarget = new JumpTarget(
- JumpTargetKind.Break, functionNestingLevel, parent, charOffset),
- continueTarget = new JumpTarget(
- JumpTargetKind.Continue, functionNestingLevel, parent, charOffset);
+ final Uri fileUri;
@override
- Uri get fileUri => parent.fileUri!;
+ final int charOffset;
+
+ LabelTarget(this.functionNestingLevel, this.fileUri, this.charOffset)
+ : breakTarget = new JumpTarget(
+ JumpTargetKind.Break, functionNestingLevel, fileUri, charOffset),
+ continueTarget = new JumpTarget(
+ JumpTargetKind.Continue, functionNestingLevel, fileUri, charOffset);
@override
bool get hasUsers => breakTarget.hasUsers || continueTarget.hasUsers;
diff --git a/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart b/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart
index 882b9f9..740f9b8 100644
--- a/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_extension_builder.dart
@@ -106,7 +106,8 @@
Builder? objectGetter = objectClassBuilder.lookupLocalMember(name);
Builder? objectSetter =
objectClassBuilder.lookupLocalMember(name, setter: true);
- if (objectGetter != null || objectSetter != null) {
+ if (objectGetter != null && !objectGetter.isStatic ||
+ objectSetter != null && !objectSetter.isStatic) {
addProblem(
templateExtensionMemberConflictsWithObjectMember
.withArguments(name),
diff --git a/pkg/front_end/testcases/general/issue48808.dart b/pkg/front_end/testcases/general/issue48808.dart
new file mode 100644
index 0000000..b955652
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48808.dart
@@ -0,0 +1,9 @@
+// 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.
+
+foo() {
+ for (const x in [1, 2, 3]) print(x);
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48808.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue48808.dart.textual_outline.expect
new file mode 100644
index 0000000..d530fa8
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48808.dart.textual_outline.expect
@@ -0,0 +1,2 @@
+foo() {}
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48808.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue48808.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..d530fa8
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48808.dart.textual_outline_modelled.expect
@@ -0,0 +1,2 @@
+foo() {}
+main() {}
diff --git a/pkg/front_end/testcases/general/issue48808.dart.weak.expect b/pkg/front_end/testcases/general/issue48808.dart.weak.expect
new file mode 100644
index 0000000..10ba349
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48808.dart.weak.expect
@@ -0,0 +1,23 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48808.dart:6:14: Error: A for-in loop-variable can't be 'const'.
+// Try removing the 'const' modifier.
+// for (const x in [1, 2, 3]) print(x);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static method foo() → dynamic {
+ {
+ invalid-expression "pkg/front_end/testcases/general/issue48808.dart:6:14: Error: A for-in loop-variable can't be 'const'.
+Try removing the 'const' modifier.
+ for (const x in [1, 2, 3]) print(x);
+ ^";
+ for (core::int x in <core::int>[1, 2, 3])
+ core::print(x);
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48808.dart.weak.modular.expect b/pkg/front_end/testcases/general/issue48808.dart.weak.modular.expect
new file mode 100644
index 0000000..10ba349
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48808.dart.weak.modular.expect
@@ -0,0 +1,23 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48808.dart:6:14: Error: A for-in loop-variable can't be 'const'.
+// Try removing the 'const' modifier.
+// for (const x in [1, 2, 3]) print(x);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static method foo() → dynamic {
+ {
+ invalid-expression "pkg/front_end/testcases/general/issue48808.dart:6:14: Error: A for-in loop-variable can't be 'const'.
+Try removing the 'const' modifier.
+ for (const x in [1, 2, 3]) print(x);
+ ^";
+ for (core::int x in <core::int>[1, 2, 3])
+ core::print(x);
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48808.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue48808.dart.weak.outline.expect
new file mode 100644
index 0000000..8570841
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48808.dart.weak.outline.expect
@@ -0,0 +1,7 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+
+static method foo() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/issue48808.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue48808.dart.weak.transformed.expect
new file mode 100644
index 0000000..4a8424f
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48808.dart.weak.transformed.expect
@@ -0,0 +1,28 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue48808.dart:6:14: Error: A for-in loop-variable can't be 'const'.
+// Try removing the 'const' modifier.
+// for (const x in [1, 2, 3]) print(x);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static method foo() → dynamic {
+ {
+ invalid-expression "pkg/front_end/testcases/general/issue48808.dart:6:14: Error: A for-in loop-variable can't be 'const'.
+Try removing the 'const' modifier.
+ for (const x in [1, 2, 3]) print(x);
+ ^";
+ {
+ core::Iterator<core::int> :sync-for-iterator = core::_GrowableList::_literal3<core::int>(1, 2, 3).{core::Iterable::iterator}{core::Iterator<core::int>};
+ for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) {
+ core::int x = :sync-for-iterator.{core::Iterator::current}{core::int};
+ core::print(x);
+ }
+ }
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue48834.dart b/pkg/front_end/testcases/general/issue48834.dart
new file mode 100644
index 0000000..160e5a2
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48834.dart
@@ -0,0 +1,18 @@
+// 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.
+
+extension HashAll on Iterable {
+ int hashAll() => 0;
+}
+
+extension HashAllList on List {
+ int hashAll() => 1;
+}
+
+void main() {
+ List l = [];
+ Iterable i = [];
+ print(l.hashAll());
+ print(i.hashAll());
+}
diff --git a/pkg/front_end/testcases/general/issue48834.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue48834.dart.textual_outline.expect
new file mode 100644
index 0000000..15b2236
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48834.dart.textual_outline.expect
@@ -0,0 +1,9 @@
+extension HashAll on Iterable {
+ int hashAll() => 0;
+}
+
+extension HashAllList on List {
+ int hashAll() => 1;
+}
+
+void main() {}
diff --git a/pkg/front_end/testcases/general/issue48834.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue48834.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..15b2236
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48834.dart.textual_outline_modelled.expect
@@ -0,0 +1,9 @@
+extension HashAll on Iterable {
+ int hashAll() => 0;
+}
+
+extension HashAllList on List {
+ int hashAll() => 1;
+}
+
+void main() {}
diff --git a/pkg/front_end/testcases/general/issue48834.dart.weak.expect b/pkg/front_end/testcases/general/issue48834.dart.weak.expect
new file mode 100644
index 0000000..ad66b8a
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48834.dart.weak.expect
@@ -0,0 +1,26 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+extension HashAll on core::Iterable<dynamic> {
+ method hashAll = self::HashAll|hashAll;
+ tearoff hashAll = self::HashAll|get#hashAll;
+}
+extension HashAllList on core::List<dynamic> {
+ method hashAll = self::HashAllList|hashAll;
+ tearoff hashAll = self::HashAllList|get#hashAll;
+}
+static method HashAll|hashAll(lowered final core::Iterable<dynamic> #this) → core::int
+ return 0;
+static method HashAll|get#hashAll(lowered final core::Iterable<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAll|hashAll(#this);
+static method HashAllList|hashAll(lowered final core::List<dynamic> #this) → core::int
+ return 1;
+static method HashAllList|get#hashAll(lowered final core::List<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAllList|hashAll(#this);
+static method main() → void {
+ core::List<dynamic> l = <dynamic>[];
+ core::Iterable<dynamic> i = <dynamic>[];
+ core::print(self::HashAllList|hashAll(l));
+ core::print(self::HashAll|hashAll(i));
+}
diff --git a/pkg/front_end/testcases/general/issue48834.dart.weak.modular.expect b/pkg/front_end/testcases/general/issue48834.dart.weak.modular.expect
new file mode 100644
index 0000000..ad66b8a
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48834.dart.weak.modular.expect
@@ -0,0 +1,26 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+extension HashAll on core::Iterable<dynamic> {
+ method hashAll = self::HashAll|hashAll;
+ tearoff hashAll = self::HashAll|get#hashAll;
+}
+extension HashAllList on core::List<dynamic> {
+ method hashAll = self::HashAllList|hashAll;
+ tearoff hashAll = self::HashAllList|get#hashAll;
+}
+static method HashAll|hashAll(lowered final core::Iterable<dynamic> #this) → core::int
+ return 0;
+static method HashAll|get#hashAll(lowered final core::Iterable<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAll|hashAll(#this);
+static method HashAllList|hashAll(lowered final core::List<dynamic> #this) → core::int
+ return 1;
+static method HashAllList|get#hashAll(lowered final core::List<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAllList|hashAll(#this);
+static method main() → void {
+ core::List<dynamic> l = <dynamic>[];
+ core::Iterable<dynamic> i = <dynamic>[];
+ core::print(self::HashAllList|hashAll(l));
+ core::print(self::HashAll|hashAll(i));
+}
diff --git a/pkg/front_end/testcases/general/issue48834.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue48834.dart.weak.outline.expect
new file mode 100644
index 0000000..530bca4
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48834.dart.weak.outline.expect
@@ -0,0 +1,22 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+extension HashAll on core::Iterable<dynamic> {
+ method hashAll = self::HashAll|hashAll;
+ tearoff hashAll = self::HashAll|get#hashAll;
+}
+extension HashAllList on core::List<dynamic> {
+ method hashAll = self::HashAllList|hashAll;
+ tearoff hashAll = self::HashAllList|get#hashAll;
+}
+static method HashAll|hashAll(lowered final core::Iterable<dynamic> #this) → core::int
+ ;
+static method HashAll|get#hashAll(lowered final core::Iterable<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAll|hashAll(#this);
+static method HashAllList|hashAll(lowered final core::List<dynamic> #this) → core::int
+ ;
+static method HashAllList|get#hashAll(lowered final core::List<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAllList|hashAll(#this);
+static method main() → void
+ ;
diff --git a/pkg/front_end/testcases/general/issue48834.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue48834.dart.weak.transformed.expect
new file mode 100644
index 0000000..3ad8a06
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue48834.dart.weak.transformed.expect
@@ -0,0 +1,26 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+extension HashAll on core::Iterable<dynamic> {
+ method hashAll = self::HashAll|hashAll;
+ tearoff hashAll = self::HashAll|get#hashAll;
+}
+extension HashAllList on core::List<dynamic> {
+ method hashAll = self::HashAllList|hashAll;
+ tearoff hashAll = self::HashAllList|get#hashAll;
+}
+static method HashAll|hashAll(lowered final core::Iterable<dynamic> #this) → core::int
+ return 0;
+static method HashAll|get#hashAll(lowered final core::Iterable<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAll|hashAll(#this);
+static method HashAllList|hashAll(lowered final core::List<dynamic> #this) → core::int
+ return 1;
+static method HashAllList|get#hashAll(lowered final core::List<dynamic> #this) → () → core::int
+ return () → core::int => self::HashAllList|hashAll(#this);
+static method main() → void {
+ core::List<dynamic> l = core::_GrowableList::•<dynamic>(0);
+ core::Iterable<dynamic> i = core::_GrowableList::•<dynamic>(0);
+ core::print(self::HashAllList|hashAll(l));
+ core::print(self::HashAll|hashAll(i));
+}
diff --git a/tools/VERSION b/tools/VERSION
index 1bebd47..a10df10 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 36
+PRERELEASE 37
PRERELEASE_PATCH 0
\ No newline at end of file