Skip to content

Commit c5cd8ff

Browse files
johnniwintherCommit Queue
authored and
Commit Queue
committed
[cfe] Remove agnostic mode
The agnostic mode was added to allow the platform dill embedded in the VM to support both weak and strong mode. Since weak mode is no longer supported in the VM, the agnostic mode can new be deleted. All uses of the agnostic in Dart and Flutter have been removed prior to this change. Change-Id: Iff0f69d9cd64e887e01cd7e7d336a97761bd6d4b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366801 Reviewed-by: Alexander Thomas <[email protected]> Commit-Queue: Johnni Winther <[email protected]> Reviewed-by: Jens Johansen <[email protected]>
1 parent d06d627 commit c5cd8ff

26 files changed

+18
-469
lines changed

build/rbe/rewrapper_dart.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ def parse_compile_platform(self):
475475
'--no-defines',
476476
'--nnbd-strong',
477477
'--nnbd-weak',
478-
'--nnbd-agnostic',
479478
'--exclude-source',
480479
]:
481480
pass

pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -241,28 +241,6 @@ Message _withArgumentsAccessError(String name) {
241241
);
242242
}
243243

244-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
245-
const Code<Null> codeAgnosticWithStrongDillLibrary =
246-
messageAgnosticWithStrongDillLibrary;
247-
248-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
249-
const MessageCode messageAgnosticWithStrongDillLibrary = const MessageCode(
250-
"AgnosticWithStrongDillLibrary",
251-
problemMessage:
252-
r"""Loaded library is compiled with sound null safety and cannot be used in compilation for agnostic null safety.""",
253-
);
254-
255-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
256-
const Code<Null> codeAgnosticWithWeakDillLibrary =
257-
messageAgnosticWithWeakDillLibrary;
258-
259-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
260-
const MessageCode messageAgnosticWithWeakDillLibrary = const MessageCode(
261-
"AgnosticWithWeakDillLibrary",
262-
problemMessage:
263-
r"""Loaded library is compiled with unsound null safety and cannot be used in compilation for agnostic null safety.""",
264-
);
265-
266244
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
267245
const Code<Null> codeAmbiguousExtensionCause = messageAmbiguousExtensionCause;
268246

@@ -12913,15 +12891,6 @@ const MessageCode messageNoUnnamedConstructorInObject = const MessageCode(
1291312891
problemMessage: r"""'Object' has no unnamed constructor.""",
1291412892
);
1291512893

12916-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
12917-
const Code<Null> codeNonAgnosticConstant = messageNonAgnosticConstant;
12918-
12919-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
12920-
const MessageCode messageNonAgnosticConstant = const MessageCode(
12921-
"NonAgnosticConstant",
12922-
problemMessage: r"""Constant value is not strong/weak mode agnostic.""",
12923-
);
12924-
1292512894
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
1292612895
const Template<Message Function(String character, int codePoint)>
1292712896
templateNonAsciiIdentifier =

pkg/front_end/lib/src/api_prototype/compiler_options.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ class CompilerOptions {
256256
/// Whether to write a file (e.g. a dill file) when reporting a crash.
257257
bool writeFileOnCrashReport = true;
258258

259-
/// Whether nnbd weak, strong or agnostic mode is used if experiment
260-
/// 'non-nullable' is enabled.
259+
/// Whether nnbd weak or strong mode is used.
261260
NnbdMode nnbdMode = NnbdMode.Strong;
262261

263262
/// The current sdk version string, e.g. "2.6.0-edge.sha1hash".

pkg/front_end/lib/src/base/command_line_options.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:kernel/target/targets.dart';
99
class Flags {
1010
// TODO(johnniwinther): What is the right name for this?
1111
static const String nnbdStrongMode = "--nnbd-strong";
12-
static const String nnbdAgnosticMode = "--nnbd-agnostic";
1312
static const String nnbdWeakMode = "--nnbd-weak";
1413

1514
static const String forceLateLowering = "--force-late-lowering";
@@ -115,8 +114,6 @@ class Options {
115114
const Option(Flags.nnbdWeakMode, const BoolValue(false));
116115
static const Option<bool> nnbdStrongMode =
117116
const Option(Flags.nnbdStrongMode, const BoolValue(false));
118-
static const Option<bool> nnbdAgnosticMode =
119-
const Option(Flags.nnbdAgnosticMode, const BoolValue(false));
120117
static const Option<String> target = const Option(
121118
Flags.target, const StringValue(defaultValue: 'vm'),
122119
aliases: ["-t"]);

pkg/front_end/lib/src/base/nnbd_mode.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
enum NnbdMode {
66
Strong,
77
Weak,
8-
Agnostic,
98
}

pkg/front_end/lib/src/base/processed_options.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ class ProcessedOptions {
298298
messageCompilingWithoutSoundNullSafety.severity);
299299
break;
300300
case NnbdMode.Strong:
301-
case NnbdMode.Agnostic:
302301
break;
303302
}
304303
}
@@ -430,8 +429,7 @@ class ProcessedOptions {
430429
'${component.libraries.join('\n')}');
431430
}
432431
if (nnbdMode == NnbdMode.Strong &&
433-
!(component.mode == NonNullableByDefaultCompiledMode.Strong ||
434-
component.mode == NonNullableByDefaultCompiledMode.Agnostic)) {
432+
component.mode != NonNullableByDefaultCompiledMode.Strong) {
435433
throw new FormatException(
436434
'Provided .dill file for the following libraries does not '
437435
'support sound null safety:\n'

pkg/front_end/lib/src/compute_platform_binaries_location.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,21 @@ String? computePlatformDillName(
3434
return 'ddc_outline_unsound.dill';
3535
//TODO(johnniwinther): Support using the full dill.
3636
//return 'ddc_platform_unsound.dill';
37-
case NnbdMode.Agnostic:
38-
break;
3937
}
40-
break;
4138
case 'dart2js':
4239
switch (nnbdMode) {
4340
case NnbdMode.Strong:
4441
return 'dart2js_platform.dill';
4542
case NnbdMode.Weak:
4643
return 'dart2js_platform_unsound.dill';
47-
case NnbdMode.Agnostic:
48-
break;
4944
}
50-
break;
5145
case 'dart2js_server':
5246
switch (nnbdMode) {
5347
case NnbdMode.Strong:
5448
return 'dart2js_server_platform.dill';
5549
case NnbdMode.Weak:
5650
return 'dart2js_server_platform_unsound.dill';
57-
case NnbdMode.Agnostic:
58-
break;
5951
}
60-
break;
6152
case 'vm':
6253
// TODO(johnniwinther): Stop generating 'vm_platform.dill' and rename
6354
// 'vm_platform_strong.dill' to 'vm_platform.dill'.
@@ -71,7 +62,6 @@ String? computePlatformDillName(
7162
//TODO(johnniwinther): Support using the full dill.
7263
//return 'dart2wasm_platform.dill';
7364
case NnbdMode.Weak:
74-
case NnbdMode.Agnostic:
7565
break;
7666
}
7767
break;
@@ -82,7 +72,6 @@ String? computePlatformDillName(
8272
//TODO(johnniwinther): Support using the full dill.
8373
//return 'dart2wasm_js_compatibility_platform.dill';
8474
case NnbdMode.Weak:
85-
case NnbdMode.Agnostic:
8675
break;
8776
}
8877
break;

pkg/front_end/lib/src/fasta/incremental_compiler.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,14 +1009,6 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
10091009
kernelTarget.loader.hasInvalidNnbdModeLibrary = true;
10101010
}
10111011
break;
1012-
case NnbdMode.Agnostic:
1013-
// Don't expect strong, weak or invalid.
1014-
if (seenModes[NonNullableByDefaultCompiledMode.Strong.index] ||
1015-
seenModes[NonNullableByDefaultCompiledMode.Weak.index] ||
1016-
seenModes[NonNullableByDefaultCompiledMode.Invalid.index]) {
1017-
kernelTarget.loader.hasInvalidNnbdModeLibrary = true;
1018-
}
1019-
break;
10201012
}
10211013
} else {
10221014
// Don't expect strong or invalid.
@@ -2705,9 +2697,6 @@ class _InitializationFromUri extends _InitializationFromSdkSummary {
27052697
case NnbdMode.Strong:
27062698
compiledMode = NonNullableByDefaultCompiledMode.Strong;
27072699
break;
2708-
case NnbdMode.Agnostic:
2709-
compiledMode = NonNullableByDefaultCompiledMode.Agnostic;
2710-
break;
27112700
}
27122701
} else {
27132702
compiledMode = NonNullableByDefaultCompiledMode.Weak;

pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,6 @@ class SetConstantBuilder extends _ListOrSetConstantBuilder<SetLiteral> {
172172
return evaluator.createEvaluationErrorConstant(
173173
context, templateConstEvalDuplicateElement.withArguments(constant));
174174
}
175-
if (evaluator.evaluationMode == EvaluationMode.agnostic) {
176-
Constant weakConstant =
177-
evaluator._weakener.visitConstant(constant) ?? constant;
178-
bool weakUnseen = weakSeen.add(weakConstant);
179-
if (unseen != weakUnseen) {
180-
return evaluator.createEvaluationErrorConstant(
181-
context, messageNonAgnosticConstant);
182-
}
183-
}
184175

185176
List<Constant> lastPart;
186177
if (parts.last is List<Constant>) {
@@ -318,14 +309,7 @@ class MapConstantBuilder {
318309
return evaluator.createEvaluationErrorConstant(
319310
keyContext, templateConstEvalDuplicateKey.withArguments(key));
320311
}
321-
if (evaluator.evaluationMode == EvaluationMode.agnostic) {
322-
Constant weakKey = evaluator._weakener.visitConstant(key) ?? key;
323-
bool weakUnseenKey = weakSeenKeys.add(weakKey);
324-
if (unseenKey != weakUnseenKey) {
325-
return evaluator.createEvaluationErrorConstant(
326-
keyContext, messageNonAgnosticConstant);
327-
}
328-
}
312+
329313
Constant key2 = evaluator.ensureIsSubtype(key, keyType, keyContext);
330314
if (key2 is AbortConstant) return key2;
331315
Constant value2 = evaluator.ensureIsSubtype(value, valueType, valueContext);

0 commit comments

Comments
 (0)