Rewrite comments to refer to legacy mode instead of strong mode
Change-Id: Ib272c3834d5e8fc4592981bb33a9b3cf21df1e5f
Reviewed-on: https://dart-review.googlesource.com/c/84412
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 9858ea16..a1517be 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -103,16 +103,16 @@
///
/// A summary, also referred to as "outline" internally, is a [Component]
/// where all method bodies are left out. In essence, it contains just API
- /// signatures and constants. When strong-mode is enabled, the summary
- /// already includes inferred types.
+ /// signatures and constants. The summary should include inferred top-level
+ /// types unless legacy mode is enabled.
Component _sdkSummaryComponent;
/// The summary for each uri in `options.inputSummaries`.
///
/// A summary, also referred to as "outline" internally, is a [Component]
/// where all method bodies are left out. In essence, it contains just API
- /// signatures and constants. When strong-mode is enabled, the summary
- /// already includes inferred types.
+ /// signatures and constants. The summaries should include inferred top-level
+ /// types unless legacy mode is enabled.
List<Component> _inputSummariesComponents;
/// Other components that are meant to be linked and compiled with the input
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 d43a56c..3358be6 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -3119,8 +3119,7 @@
if (typeParameters.length != types.length) {
if (types.length == 0) {
// Expected `typeParameters.length` type arguments, but none given, so
- // we fill in dynamic in legacy mode, and use type inference in strong
- // mode.
+ // we fill in dynamic in legacy mode, and use type inference otherwise.
if (library.loader.target.legacyMode) {
for (int i = 0; i < typeParameters.length; i++) {
types.add(const DynamicType());
@@ -3320,10 +3319,10 @@
Expression invocation;
if (library.loader.target.legacyMode && isRedirectingFactory(target)) {
- // In non-strong mode the checks that are done in
- // [buildStaticInvocation] on the initial target of a redirecting
- // factory invocation should be skipped. So, we build the invocation
- // nodes directly here without doing any checks.
+ // In legacy mode the checks that are done in [buildStaticInvocation]
+ // on the initial target of a redirecting factory invocation should
+ // be skipped. So we build the invocation nodes directly here without
+ // doing any checks.
if (target.function.typeParameters != null &&
target.function.typeParameters.length !=
forest.argumentsTypeArguments(arguments).length) {
@@ -4361,8 +4360,6 @@
}
initializedFields[name] = assignmentOffset;
if (builder.isFinal && builder.hasInitializer) {
- // TODO(ahe): If CL 2843733002 is landed, this becomes a compile-time
- // error. Also, this is a compile-time error in strong mode.
addProblem(
fasta.templateFinalInstanceVariableAlreadyInitialized
.withArguments(name),
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 3fa4df8..50223d0 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -680,7 +680,7 @@
// is inferred (the kernel code is discarded).
if (isTopLevel) return null;
- // This logic is strong mode only; in legacy mode anything goes.
+ // In legacy mode, we don't check assignability.
if (legacyMode) return null;
// If an interface type is being assigned to a function type, see if we
@@ -790,9 +790,9 @@
bool instrumented: true}) {
assert(receiverType != null && isKnown(receiverType));
- // Our non-strong golden files currently don't include interface
- // targets, so we can't store the interface target without causing tests
- // to fail. TODO(paulberry): fix this.
+ // Our legacy golden files currently don't include interface targets, so we
+ // can't store the interface target without causing tests to fail.
+ // TODO(paulberry): fix this.
if (legacyMode) return null;
receiverType = resolveTypeParameter(receiverType);
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 1d79ba3..f80e641 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -2510,6 +2510,9 @@
FinalInstanceVariableAlreadyInitialized:
template: "'#name' is a final instance variable that has already been initialized."
+ # TODO(ahe): Strictly speaking, as of
+ # 3b5874a332b24f326775b3520f32b9a818731aca, this is a compile-time error in
+ # legacy mode.
severity: ERROR_LEGACY_WARNING
analyzerCode: FINAL_INITIALIZED_MULTIPLE_TIMES