Remove var and final from parameters in pkg/.

Doesn't change anything in `front_end/*testcases/primary_constructors/`.
(Would have skipped any other file with `test` in its path and
an explicit language version marker, but there weren't any outside
of those `front_end` directories).

Almost no files used as test input were affected, and none testing the actual syntax changed.
The `.../nnbd/required_2.dart` test case was split into a legacy version retaining the `var`/`final` with a language marker, and a new version without the `var`/`final` cases.

The `pkg/analyzer/` tests, and any other tests that have source code
in strings, are not migrated by this CL.

Tested: No change to behavior. One test split into legacy and new.
Change-Id: I7f5aa4cc98001a9adecacd106c0b3be14f96be1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480542
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Lasse R.H. Nielsen
2026-04-10 09:09:39 -07:00
committed by Commit Queue
parent 4b01d6b803
commit 711e50389f
69 changed files with 661 additions and 242 deletions
@@ -1741,7 +1741,7 @@ class Parser {
/// ( ',' recordTypeNamedField )* ','? '}'
/// recordTypeNamedField ::= metadata type identifier
Token parseRecordType(
final Token start,
Token start,
Token token,
bool isQuestionMarkPartOfType,
) {
@@ -2840,7 +2840,7 @@ class Parser {
/// and the last skipped token is returned.
/// Otherwise null is returned.
Token? recoverySmallLookAheadSkipTokens(
final Token token,
Token token,
List<TokenType> lookFor,
) {
// Recovery: Allow a small lookahead for '{'. E.g. the user might be in
@@ -4751,7 +4751,7 @@ class Parser {
/// ```
/// 'super' ('.' identifier)? arguments ;
/// ```
Token parseSuperInitializerExpression(final Token start) {
Token parseSuperInitializerExpression(Token start) {
Token token = start.next!;
assert(token.isA(Keyword.SUPER));
Token next = token.next!;
@@ -8519,10 +8519,7 @@ class Parser {
/// genericFunctionLiteral ::=
/// typeParameters formalParameterList functionBody
/// Provide token for [constKeyword] if preceded by 'const', null if not.
Token parseLiteralListSetMapOrFunction(
final Token start,
Token? constKeyword,
) {
Token parseLiteralListSetMapOrFunction(Token start, Token? constKeyword) {
assert(start.next!.isA(TokenType.LT));
TypeParamOrArgInfo typeParamOrArg = computeTypeParamOrArg(
start,
@@ -9547,7 +9544,7 @@ class Parser {
token.isA(Keyword.SYNC);
}
Token parseExpressionStatementOrConstDeclaration(final Token start) {
Token parseExpressionStatementOrConstDeclaration(Token start) {
Token constToken = start.next!;
assert(constToken.isA(Keyword.CONST));
if (!isModifier(constToken.next!)) {
@@ -9596,7 +9593,7 @@ class Parser {
/// local variable declaration nor a pattern variable declaration is found,
/// then this method will return [start].
Token parseExpressionStatementOrDeclaration(
final Token start, [
Token start, [
ForPartsContext? forPartsContext,
]) {
Token token = start;
@@ -156,7 +156,7 @@ bool isValidNonRecordTypeReference(Token token) {
/// If [inDeclaration] is `true`, then this will more aggressively recover
/// given unbalanced `<` `>` and invalid parameters or arguments.
TypeInfo computeType(
final Token token,
Token token,
bool required, [
bool inDeclaration = false,
bool acceptKeywordForSimpleType = false,
@@ -879,10 +879,7 @@ class ComplexTypeInfo implements TypeInfo {
/// Check if the presumed record type has correct syntax between its
/// parenthesis. If not [recovered] will be set to true.
/// Keep in sync with [Parser.parseRecordType] et al.
void _checkIfRecordTypeParenthesisAreRecovered(
Token token,
final Token endGroup,
) {
void _checkIfRecordTypeParenthesisAreRecovered(Token token, Token endGroup) {
int parameterCount = 0;
bool hasNamedFields = false;
bool hasComma = false;
@@ -30,12 +30,12 @@ class Features {
/// Mark the feature [key] as existing. If [value] is provided, the feature
/// [key] is set to have this value.
void add(String key, {var value = ''}) {
void add(String key, {value = ''}) {
_features[key] = value.toString();
}
/// Add [value] as an element of the list values of feature [key].
void addElement(String key, [var value]) {
void addElement(String key, [value]) {
List<String> list =
_features.putIfAbsent(key, () => <String>[]) as List<String>;
if (value != null) {
@@ -2172,7 +2172,7 @@ mixin TypeAnalyzer<
SwitchStatementTypeAnalysisResult<Error> analyzeSwitchStatement(
Statement node,
Expression scrutinee,
final int numCases,
int numCases,
) {
// Stack: ()
ExpressionTypeAnalysisResult scrutineeAnalysisResult = analyzeExpression(
+12 -12
View File
@@ -147,7 +147,7 @@ class FunctionConstantValue extends ConstantValue {
FunctionConstantValue(this.element, this.type);
@override
bool operator ==(var other) {
bool operator ==(other) {
if (other is! FunctionConstantValue) return false;
return identical(other.element, element);
}
@@ -187,7 +187,7 @@ abstract class PrimitiveConstantValue extends ConstantValue {
const PrimitiveConstantValue();
@override
bool operator ==(var other) {
bool operator ==(other) {
// Making this method abstract does not give us an error.
throw UnsupportedError('PrimitiveConstant.==');
}
@@ -277,7 +277,7 @@ class IntConstantValue extends NumConstantValue {
DartType getType(CommonElements types) => types.intType;
@override
bool operator ==(var other) {
bool operator ==(other) {
// Ints and doubles are treated as separate constants.
if (other is! IntConstantValue) return false;
IntConstantValue otherInt = other;
@@ -347,7 +347,7 @@ class DoubleConstantValue extends NumConstantValue {
DartType getType(CommonElements types) => types.doubleType;
@override
bool operator ==(var other) {
bool operator ==(other) {
if (other is! DoubleConstantValue) return false;
DoubleConstantValue otherDouble = other;
double otherValue = otherDouble.doubleValue;
@@ -416,7 +416,7 @@ class TrueConstantValue extends BoolConstantValue {
FalseConstantValue negate() => FalseConstantValue();
@override
bool operator ==(var other) => identical(this, other);
bool operator ==(other) => identical(this, other);
// The magic constant is just a random value. It does not have any
// significance.
@@ -439,7 +439,7 @@ class FalseConstantValue extends BoolConstantValue {
TrueConstantValue negate() => TrueConstantValue();
@override
bool operator ==(var other) => identical(this, other);
bool operator ==(other) => identical(this, other);
// The magic constant is just a random value. It does not have any
// significance.
@@ -465,7 +465,7 @@ class StringConstantValue extends PrimitiveConstantValue {
DartType getType(CommonElements types) => types.stringType;
@override
bool operator ==(var other) {
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! StringConstantValue) return false;
StringConstantValue otherString = other;
@@ -552,7 +552,7 @@ class ListConstantValue extends ObjectConstantValue {
: hashCode = Hashing.listHash(entries, Hashing.objectHash(type));
@override
bool operator ==(var other) {
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! ListConstantValue) return false;
ListConstantValue otherList = other;
@@ -614,7 +614,7 @@ abstract class SetConstantValue extends ObjectConstantValue {
: hashCode = Hashing.listHash(values, Hashing.objectHash(type));
@override
bool operator ==(var other) {
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! SetConstantValue) return false;
SetConstantValue otherSet = other;
@@ -677,7 +677,7 @@ abstract class MapConstantValue extends ObjectConstantValue {
}
@override
bool operator ==(var other) {
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! MapConstantValue) return false;
MapConstantValue otherMap = other;
@@ -927,7 +927,7 @@ class ConstructedConstantValue extends ObjectConstantValue {
: hashCode = Hashing.unorderedMapHash(fields, Hashing.objectHash(type));
@override
bool operator ==(var other) {
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! ConstructedConstantValue) return false;
if (hashCode != other.hashCode) return false;
@@ -1123,7 +1123,7 @@ class JavaScriptObjectConstantValue extends ConstantValue {
}
@override
bool operator ==(var other) {
bool operator ==(other) {
return identical(this, other) ||
other is JavaScriptObjectConstantValue && _equals(this, other);
}
@@ -841,7 +841,7 @@ class FlatTypeMask extends TypeMask {
}
@override
bool operator ==(var other) {
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! FlatTypeMask) return false;
return (_flags == other._flags) && (base == other.base);
@@ -245,7 +245,7 @@ class FormattingDiagnosticHandler implements api.CompilerDiagnostics {
@override
void report(
var code,
code,
Uri? uri,
int? begin,
int? end,
@@ -818,7 +818,7 @@ class ArticleView extends View {
}
}
String getDataUriForImage(final img) {
String getDataUriForImage(img) {
// TODO(hiltonc,jimhug) eval perf of this vs. reusing one canvas element
final CanvasElement canvas = CanvasElement(
height: img.height,
+1 -1
View File
@@ -39,7 +39,7 @@ class EventListeners {
listeners.add(listener);
}
void fire(var event) {
void fire(event) {
for (final listener in listeners) {
listener(event);
}
@@ -28,7 +28,7 @@ class EventBatch {
/// Ensure there is an event batch where [userFunction] can accumulate events.
/// When the batch is complete, fire all events at once.
static void Function(T) wrap<T>(userFunction(var a)) {
static void Function(T) wrap<T>(userFunction(a)) {
return (e) {
if (current == null) {
// Not in a batch so create one.
@@ -16,7 +16,7 @@ class Coordinate {
/// Gets the coordinates of a touch's location relative to the window's
/// viewport. [input] is either a touch object or an event object.
Coordinate.fromClient(var input) : this(input.client.x, input.client.y);
Coordinate.fromClient(input) : this(input.client.x, input.client.y);
static Coordinate difference(Coordinate a, Coordinate b) {
return Coordinate(a.x - b.x, a.y - b.y);
@@ -73,8 +73,8 @@ bool equality(a, b) => a == b;
/// Check that the values [property] of [object1] and [object2], [value1] and
/// [value2] respectively, are equal and throw otherwise.
bool check<T>(
var object1,
var object2,
object1,
object2,
String property,
T value1,
T value2, [
@@ -186,8 +186,8 @@ Set<E> computeSetDifference<E>(
///
/// Uses [object1], [object2] and [property] to provide context for failures.
bool checkSetEquivalence<E>(
var object1,
var object2,
object1,
object2,
String property,
Iterable<E> set1,
Iterable<E> set2,
@@ -221,8 +221,8 @@ bool checkSetEquivalence<E>(
///
/// Uses [object1], [object2] and [property] to provide context for failures.
bool checkMapEquivalence<K, V>(
var object1,
var object2,
object1,
object2,
String property,
Map<K, V> map1,
Map<K, V> map2,
@@ -19,7 +19,7 @@ class C {
/*member: C.a:[empty|powerset=empty]*/
C.a(
int /*[exact=JSUInt31|powerset={I}{O}{N}]*/ x, [
var /*Union([exact=JSString|powerset={I}{O}{I}], [exact=_SECRET|powerset={N}{O}{N}], powerset: {IN}{O}{IN})*/ b =
/*Union([exact=JSString|powerset={I}{O}{I}], [exact=_SECRET|powerset={N}{O}{N}], powerset: {IN}{O}{IN})*/ b =
const _SECRET(),
]) : this.x = x,
this.y = b;
@@ -27,7 +27,7 @@ class C {
/*member: C.b:[empty|powerset=empty]*/
C.b(
int /*[exact=JSUInt31|powerset={I}{O}{N}]*/ x, {
var /*Union([exact=JSString|powerset={I}{O}{I}], [exact=_SECRET|powerset={N}{O}{N}], powerset: {IN}{O}{IN})*/ b =
/*Union([exact=JSString|powerset={I}{O}{I}], [exact=_SECRET|powerset={N}{O}{N}], powerset: {IN}{O}{IN})*/ b =
const _SECRET(),
}) : this.x = x,
this.y = b;
@@ -6,7 +6,7 @@ import 'dart:collection';
/*member: dynamicIndex:Specializer=[!Index]*/
@pragma('dart2js:noInline')
dynamicIndex(var list) {
dynamicIndex(list) {
return list[0]; // This not known to be an indexable primitive.
}
@@ -4,7 +4,7 @@
/*member: dynamicIndexAssign:Specializer=[!IndexAssign]*/
@pragma('dart2js:noInline')
dynamicIndexAssign(var list) {
dynamicIndexAssign(list) {
list[0] = 1;
}
@@ -7,7 +7,7 @@ import 'dart:typed_data';
/*member: dynamicIndex:Specializer=[!RemoveLast]*/
@pragma('dart2js:noInline')
dynamicIndex(var list) {
dynamicIndex(list) {
return list.removeLast(); // This is not known to be an indexable primitive.
}
@@ -13,7 +13,7 @@ class A1 implements A<C1> {}
/*class: B:explicit=[B.T],needsArgs,test*/
class B<T> {
@pragma('dart2js:noInline')
method(var t) => t is T;
method(t) => t is T;
}
/*class: C:implicit=[List<A<C>>]*/
@@ -34,9 +34,9 @@ class G<T, S, U, W> {}
typedef classesFunc({A? a, B? b, C? c, D? d});
typedef genericsFunc({Map<num, int>? m, List<List<B>>? l, G<A, B, C, D>? g});
typedef dynamicFunc({var x, var y, var z, var v});
typedef dynamicFunc({x, y, z, v});
typedef funcFunc({classesFunc? f1, genericsFunc? f2, dynamicFunc? f3});
typedef mixFunc({var x, B? b, G<A, B, C, D>? g, funcFunc? f});
typedef mixFunc({x, B? b, G<A, B, C, D>? g, funcFunc? f});
typedef okWithClassesFunc_1({A? a, A1? b, A1? c, A1? d});
typedef okWithClassesFunc_2({D? a, D? b, D? c, D? d});
@@ -52,7 +52,7 @@ typedef okWithGenericsFunc_2({
G<D, D, D, D>? g,
});
typedef okWithDynamicFunc_1({A? x, G? y, mixFunc? z, var v});
typedef okWithDynamicFunc_1({A? x, G? y, mixFunc? z, v});
typedef okWithDynamicFunc_2({int? x, bool? y, List<Map>? z, classesFunc? v});
main() {
@@ -78,7 +78,7 @@ main() {
);
makeLive(
/*needsSignature*/
({var a, var b, var c, var d}) {} is classesFunc,
({a, b, c, d}) {} is classesFunc,
);
makeLive(
/*needsSignature*/
@@ -96,7 +96,7 @@ main() {
);
makeLive(
/*needsSignature*/
({var m, var l, var g}) {} is genericsFunc,
({m, l, g}) {} is genericsFunc,
);
makeLive(
/*needsSignature*/
@@ -105,7 +105,7 @@ main() {
makeLive(
/*needsSignature*/
({A? x, G? y, mixFunc? z, var v}) {} is dynamicFunc,
({A? x, G? y, mixFunc? z, v}) {} is dynamicFunc,
);
makeLive(
/*needsSignature*/
@@ -23,7 +23,7 @@ class D implements C {}
typedef t1({B? a});
typedef t2({C? c});
typedef t3({int? i});
typedef t4({var v});
typedef t4({v});
typedef t5({Map? m});
typedef t6({Map<int, num>? m});
typedef t7({t1? f});
@@ -40,26 +40,26 @@ main() {
makeLive(/*needsSignature*/ ({C? a}) {} is t1);
makeLive(/*needsSignature*/ ({D? a}) {} is t1);
makeLive(/*needsSignature*/ ({Object? a}) {} is t1);
makeLive(/*needsSignature*/ ({var a}) {} is t1);
makeLive(/*needsSignature*/ ({a}) {} is t1);
makeLive(/*needsSignature*/ ({A? c}) {} is t2);
makeLive(/*needsSignature*/ ({B? c}) {} is t2);
makeLive(/*needsSignature*/ ({C? c}) {} is t2);
makeLive(/*needsSignature*/ ({D? c}) {} is t2);
makeLive(/*needsSignature*/ ({Object? c}) {} is t2);
makeLive(/*needsSignature*/ ({var c}) {} is t2);
makeLive(/*needsSignature*/ ({c}) {} is t2);
makeLive(/*needsSignature*/ ({num? i}) {} is t3);
makeLive(/*needsSignature*/ ({int? i}) {} is t3);
makeLive(/*needsSignature*/ ({Object? i}) {} is t3);
makeLive(/*needsSignature*/ ({var i}) {} is t3);
makeLive(/*needsSignature*/ ({i}) {} is t3);
makeLive(/*needsSignature*/ ({A? v}) {} is t4);
makeLive(/*needsSignature*/ ({B? v}) {} is t4);
makeLive(/*needsSignature*/ ({C? v}) {} is t4);
makeLive(/*needsSignature*/ ({D? v}) {} is t4);
makeLive(/*needsSignature*/ ({Object? v}) {} is t4);
makeLive(/*needsSignature*/ ({var v}) {} is t4);
makeLive(/*needsSignature*/ ({v}) {} is t4);
makeLive(/*needsSignature*/ ({num? v}) {} is t4);
makeLive(/*needsSignature*/ ({int? v}) {} is t4);
makeLive(/*needsSignature*/ ({Map? v}) {} is t4);
@@ -73,7 +73,7 @@ main() {
makeLive(/*needsSignature*/ ({Map? m}) {} is t5);
makeLive(/*needsSignature*/ ({Map<List, t8>? m}) {} is t5);
makeLive(/*needsSignature*/ ({Object? m}) {} is t5);
makeLive(/*needsSignature*/ ({var m}) {} is t5);
makeLive(/*needsSignature*/ ({m}) {} is t5);
makeLive(/*needsSignature*/ ({Map<List, List>? m}) {} is t5);
makeLive(/*needsSignature*/ ({Map<int, t8>? m}) {} is t5);
@@ -81,7 +81,7 @@ main() {
makeLive(/*needsSignature*/ ({Map<int, int>? m}) {} is t6);
makeLive(/*needsSignature*/ ({Map? m}) {} is t6);
makeLive(/*needsSignature*/ ({Object? m}) {} is t6);
makeLive(/*needsSignature*/ ({var m}) {} is t6);
makeLive(/*needsSignature*/ ({m}) {} is t6);
makeLive(/*needsSignature*/ ({okWithT1_1? f}) {} is t7);
makeLive(/*needsSignature*/ ({okWithT1_2? f}) {} is t7);
@@ -93,7 +93,7 @@ main() {
makeLive(/*needsSignature*/ ({C? a}) {} is t8);
makeLive(/*needsSignature*/ ({D? a}) {} is t8);
makeLive(/*needsSignature*/ ({Object? a}) {} is t8);
makeLive(/*needsSignature*/ ({var a}) {} is t8);
makeLive(/*needsSignature*/ ({a}) {} is t8);
makeLive(/*needsSignature*/ ({num? a}) {} is t8);
makeLive(/*needsSignature*/ ({int? a}) {} is t8);
makeLive(/*needsSignature*/ ({Map? a}) {} is t8);
@@ -36,9 +36,9 @@ class G<T, S, U, W> {}
typedef classesFunc({A? a, B? b, C? c, D? d});
typedef genericsFunc({Map<num, int>? m, List<List<B>>? l, G<A, B, C, D>? g});
typedef dynamicFunc({var x, var y, var z, var v});
typedef dynamicFunc({x, y, z, v});
typedef funcFunc({classesFunc? f1, genericsFunc? f2, dynamicFunc? f3});
typedef mixFunc({var x, B? b, G<A, B, C, D>? g, funcFunc? f});
typedef mixFunc({x, B? b, G<A, B, C, D>? g, funcFunc? f});
typedef okWithClassesFunc_1({A? a, A1? b, A1? c, A1? d});
typedef okWithClassesFunc_2({D? a, D? b, D? c, D? d});
@@ -54,7 +54,7 @@ typedef okWithGenericsFunc_2({
G<D, D, D, D>? g,
});
typedef okWithDynamicFunc_1({A? x, G? y, mixFunc? z, var v});
typedef okWithDynamicFunc_1({A? x, G? y, mixFunc? z, v});
typedef okWithDynamicFunc_2({int? x, bool? y, List<Map>? z, classesFunc? v});
main() {
@@ -80,7 +80,7 @@ main() {
);
makeLive(
/*checks=[$signature],instance*/
({var a, var b, var c, var d}) {} is classesFunc,
({a, b, c, d}) {} is classesFunc,
);
makeLive(
/*checks=[$signature],instance*/
@@ -98,7 +98,7 @@ main() {
);
makeLive(
/*checks=[$signature],instance*/
({var m, var l, var g}) {} is genericsFunc,
({m, l, g}) {} is genericsFunc,
);
makeLive(
/*checks=[$signature],instance*/
@@ -107,7 +107,7 @@ main() {
makeLive(
/*checks=[$signature],instance*/
({A? x, G? y, mixFunc? z, var v}) {} is dynamicFunc,
({A? x, G? y, mixFunc? z, v}) {} is dynamicFunc,
);
makeLive(
/*checks=[$signature],instance*/
@@ -33,12 +33,12 @@ void _setScheduleImmediateClosure(_ScheduleImmediateClosure closure) {
base class _NamespaceImpl implements _Namespace {
_NamespaceImpl._();
external static _NamespaceImpl _create(_NamespaceImpl namespace, var n);
external static _NamespaceImpl _create(_NamespaceImpl namespace, n);
external static int _getPointer(_NamespaceImpl namespace);
external static int _getDefault();
static _NamespaceImpl? _cachedNamespace = null;
static void _setupNamespace(var namespace) {
static void _setupNamespace(namespace) {
_cachedNamespace = _create(new _NamespaceImpl._(), namespace);
}
@@ -53,7 +53,7 @@ base class _NamespaceImpl implements _Namespace {
}
class _Namespace {
static void _setupNamespace(var namespace) {
static void _setupNamespace(namespace) {
_NamespaceImpl._setupNamespace(namespace);
}
+2 -2
View File
@@ -1066,7 +1066,7 @@ class MachOLinkeditDataCommand extends MachOLoadCommand {
);
static MachOLinkeditDataCommand fromStream(
int code, final int size, MachOReader stream) {
int code, int size, MachOReader stream) {
final dataFileOffset = stream.readUint32();
final dataSize = stream.readUint32();
@@ -1113,7 +1113,7 @@ class MachOEncryptionInfoCommand extends MachOLoadCommand {
this.fileSize, this.encryptionSystem, this.padding);
static MachOEncryptionInfoCommand fromStream(
int code, final int size, MachOReader stream) {
int code, int size, MachOReader stream) {
final is64Bit =
LoadCommandType.fromCode(code) == LoadCommandType.encryptionInfo64;
@@ -19,7 +19,7 @@ final residentServerShutdownCommand = jsonEncode(<String, Object>{
commandString: shutdownString,
});
File? getResidentCompilerInfoFileConsideringArgs(final ArgResults args) =>
File? getResidentCompilerInfoFileConsideringArgs(ArgResults args) =>
getResidentCompilerInfoFileConsideringArgsImpl(
args[CompilationServerCommand.residentCompilerInfoFileFlag] ??
args[CompilationServerCommand.legacyResidentServerInfoFileFlag],
@@ -56,7 +56,7 @@ Future<void> shutDownOrForgetResidentFrontendCompiler(File infoFile) async {
cleanupResidentServerInfo(infoFile);
}
Future<bool> isFileKernelFile(final File file) async {
Future<bool> isFileKernelFile(File file) async {
final bytes = await file.openRead(0, 4).expand((i) => i).toList();
if (bytes.length < 4) {
return false;
@@ -68,7 +68,7 @@ Future<bool> isFileKernelFile(final File file) async {
bytes[3] == 0xef;
}
Future<bool> isFileAppJitSnapshot(final File file) async {
Future<bool> isFileAppJitSnapshot(File file) async {
final bytes = await file.openRead(0, 8).expand((i) => i).toList();
if (bytes.length < 8) {
return false;
@@ -84,7 +84,7 @@ Future<bool> isFileAppJitSnapshot(final File file) async {
bytes[7] == 0;
}
Future<bool> isFileAotSnapshot(final File file) async {
Future<bool> isFileAotSnapshot(File file) async {
// Check for any of the magic numbers that can be found at the start of an
// AOT snapshot.
@@ -341,7 +341,7 @@ abstract class FunctionTypeBuilderImpl extends FunctionTypeBuilder {
Map<TypeParameterBuilder, TypeBuilder> upperSubstitution,
Map<TypeParameterBuilder, TypeBuilder> lowerSubstitution,
TypeParameterFactory typeParameterFactory, {
final Variance variance = Variance.covariant,
Variance variance = Variance.covariant,
}) {
List<StructuralParameterBuilder>? typeParameters = this.typeParameters;
List<ParameterBuilder>? formals = this.formals;
@@ -1010,7 +1010,7 @@ abstract class NamedTypeBuilderImpl extends NamedTypeBuilder {
Map<TypeParameterBuilder, TypeBuilder> upperSubstitution,
Map<TypeParameterBuilder, TypeBuilder> lowerSubstitution,
TypeParameterFactory typeParameterFactory, {
final Variance variance = Variance.covariant,
Variance variance = Variance.covariant,
}) {
TypeDeclarationBuilder declaration = this.declaration;
List<TypeBuilder>? arguments = this.typeArguments;
@@ -425,7 +425,7 @@ abstract class RecordTypeBuilderImpl extends RecordTypeBuilder {
Map<TypeParameterBuilder, TypeBuilder> upperSubstitution,
Map<TypeParameterBuilder, TypeBuilder> lowerSubstitution,
TypeParameterFactory typeParameterFactory, {
final Variance variance = Variance.covariant,
Variance variance = Variance.covariant,
}) {
List<RecordTypeFieldBuilder>? positionalFields = this.positionalFields;
List<RecordTypeFieldBuilder>? namedFields = this.namedFields;
@@ -497,7 +497,7 @@ sealed class TypeBuilder {
Map<TypeParameterBuilder, TypeBuilder> upperSubstitution,
Map<TypeParameterBuilder, TypeBuilder> lowerSubstitution,
TypeParameterFactory typeParameterFactory, {
final Variance variance = Variance.covariant,
Variance variance = Variance.covariant,
});
TypeBuilder? unaliasAndErase();
@@ -37,7 +37,7 @@ class Benchmarker {
_currentPhase = BenchmarkPhases.implicitInitialization;
}
void beginSubdivide(final BenchmarkSubdivides phase) {
void beginSubdivide(BenchmarkSubdivides phase) {
_pauseLatestSubdivide(addAsCount: false);
_subdivideStopwatch.reset();
_subdivides.add(phase);
+1 -1
View File
@@ -428,7 +428,7 @@ Future<void> _run(String script, List<String> scriptArguments) async {
// but we only want to actually run it once. To that end we - from the changed
// files figure out which would call this script, and only if the caller is
// the top one (just alphabetically sorted) we actually run.
bool _shouldRun(final List<String> changedFiles, final String callerPath) {
bool _shouldRun(List<String> changedFiles, String callerPath) {
Uri pkgDir = _repoDir.resolve("pkg/");
Uri callerUri = Uri.base.resolveUri(Uri.file(callerPath));
int? endPathIndex = _getPathSegmentIndexIfSubEntry(pkgDir, callerUri);
@@ -235,7 +235,7 @@ class BinaryMdDillReader {
/// * "Class extends Node {" into "Class"
/// * "Byte tag = 97;" into "Byte"
/// * "List<T> {" into "List<T>"
String _getType(final String inputString) {
String _getType(String inputString) {
String? cached = _typeCache[inputString];
if (cached != null) return cached;
int end = math.max(
+2 -2
View File
@@ -35,8 +35,8 @@ Future<Coverage?> collectCoverage({
Future<Coverage?> collectCoverageWithHelper({
required VMServiceHelper helper,
required final bool getKernelServiceCoverageToo,
required final String displayName,
required bool getKernelServiceCoverageToo,
required String displayName,
bool forceCompile = false,
}) async {
VM vm = await helper.serviceClient.getVM();
@@ -1326,7 +1326,7 @@ worlds:
_fs.data[uri] = latestCrashData;
}
Future<void> _deleteBlocks(final Uri uri, Component initialComponent) async {
Future<void> _deleteBlocks(Uri uri, Component initialComponent) async {
if (uri.toString().endsWith(".json")) {
// Try to find annoying
//
@@ -1747,7 +1747,7 @@ worlds:
Future<void> _deleteBlocksHelper(
ClassOrMixinOrExtensionBodyEnd body,
_CompilationHelperClass helper,
final Uri uri,
Uri uri,
Component initialComponent,
) async {
for (ParserAstNode child in body.children!) {
+2 -2
View File
@@ -817,7 +817,7 @@ Future<Null> basicTest(
Future<Map<String, Uint8List>> createModules(
Map<String, Map<String, String>> module,
final List<int> sdkSummaryData,
List<int> sdkSummaryData,
Target target,
Target originalTarget,
String sdkSummary, {
@@ -2769,7 +2769,7 @@ String nodeToString(TreeNode node) {
String componentToStringSdkFiltered(
Component component, {
required final Set<String>? printErrors,
required Set<String>? printErrors,
}) {
Component c = new Component();
List<Uri> dartUris = <Uri>[];
+2 -2
View File
@@ -65,7 +65,7 @@ Future<void> useDirect(int shards, int shard) async {
await Future.wait(futures);
}
Future<void> useIsolates(final int j) async {
Future<void> useIsolates(int j) async {
Stopwatch stopwatch = new Stopwatch()..start();
print("Using $j isolates...");
List<Future> futures = [];
@@ -88,7 +88,7 @@ Future<void> useIsolates(final int j) async {
await Future.wait(futures);
}
Future<void> useProcesses(final int j) async {
Future<void> useProcesses(int j) async {
Stopwatch stopwatch = new Stopwatch()..start();
print("Using $j processes...");
String script = Platform.script.toFilePath();
@@ -79,9 +79,9 @@ Future<void> main(List<String> args) async {
}
Future<Component> processUri(
final List<Uri> inputs,
List<Uri> inputs,
Component? fullComponent,
final Uri packageUri,
Uri packageUri,
) async {
TargetFlags targetFlags = new TargetFlags(trackWidgetCreation: false);
Target? target = new Dart2jsTarget("dart2js", targetFlags);
+6 -9
View File
@@ -595,7 +595,7 @@ class TestParser extends Parser {
@override
Token parseRecordType(
final Token start,
Token start,
Token token,
bool isQuestionMarkPartOfType,
) {
@@ -851,7 +851,7 @@ class TestParser extends Parser {
@override
Token? recoverySmallLookAheadSkipTokens(
final Token token,
Token token,
List<TokenType> lookFor,
) {
doPrint(
@@ -1585,7 +1585,7 @@ class TestParser extends Parser {
}
@override
Token parseSuperInitializerExpression(final Token start) {
Token parseSuperInitializerExpression(Token start) {
doPrint(
'parseSuperInitializerExpression('
'$start)',
@@ -2553,10 +2553,7 @@ class TestParser extends Parser {
}
@override
Token parseLiteralListSetMapOrFunction(
final Token start,
Token? constKeyword,
) {
Token parseLiteralListSetMapOrFunction(Token start, Token? constKeyword) {
doPrint(
'parseLiteralListSetMapOrFunction('
'$start, '
@@ -2944,7 +2941,7 @@ class TestParser extends Parser {
}
@override
Token parseExpressionStatementOrConstDeclaration(final Token start) {
Token parseExpressionStatementOrConstDeclaration(Token start) {
doPrint(
'parseExpressionStatementOrConstDeclaration('
'$start)',
@@ -2957,7 +2954,7 @@ class TestParser extends Parser {
@override
Token parseExpressionStatementOrDeclaration(
final Token start, [
Token start, [
ForPartsContext? forPartsContext,
]) {
doPrint(
+5 -3
View File
@@ -2,14 +2,16 @@
// 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.
method({int a = 42, required int b, required final int c}) {}
// Test intended for post-primary constructors language versions, where
// `final` cannot occur in non-primary parameters.
method({int a = 42, required int b, required int c}) {}
class Class {
method(
{int a = 42,
required int b,
required final int c,
required covariant final int d}) {}
required covariant int c}) {}
}
// TODO(johnniwinther): Pass the required property to the function types.
@@ -2,65 +2,50 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2.dart:5:46: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// method({int a = 42, required int b, required final int c}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:11:18: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required final int c,
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:12:28: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required covariant final int d}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:29:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:31:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:51:18: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:53:18: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// Function(int a = 42, [int b]) f2;
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:52:17: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:54:17: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:53:15: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:55:15: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// f2 = (int a = 42, [int b]) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:48:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:50:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:48:31: Error: Named parameter 'b' is required and can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:50:31: Error: Named parameter 'b' is required and can't have a default value.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:49:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:51:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:49:29: Error: Named parameter 'b' is required and can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:51:29: Error: Named parameter 'b' is required and can't have a default value.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:52:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:54:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:53:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:55:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f2 = (int a = 42, [int b]) {};
// ^
@@ -74,7 +59,7 @@ class Class extends core::Object {
synthetic constructor •() → self::Class
: super core::Object::•()
;
method method({core::int a = #C1, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic {}
method method({core::int a = #C1, required core::int b, required covariant-by-declaration core::int c}) → dynamic {}
}
abstract class A extends core::Object {
synthetic constructor •() → self::A
@@ -95,7 +80,7 @@ class C extends self::A {
method foo({core::int x = #C1}) → dynamic {}
}
static field ({a: core::int, required b: core::int}) → dynamic field = ({core::int a = #C1, required core::int b}) → Null {};
static method method({core::int a = #C1, required core::int b, required final core::int c}) → dynamic {}
static method method({core::int a = #C1, required core::int b, required core::int c}) → dynamic {}
static method ok() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({core::int a = #C1, required core::int b}) → void {}
@@ -2,65 +2,50 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2.dart:5:46: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// method({int a = 42, required int b, required final int c}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:11:18: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required final int c,
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:12:28: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required covariant final int d}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:29:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:31:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:51:18: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:53:18: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// Function(int a = 42, [int b]) f2;
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:52:17: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:54:17: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:53:15: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:55:15: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// f2 = (int a = 42, [int b]) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:48:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:50:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:48:31: Error: Named parameter 'b' is required and can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:50:31: Error: Named parameter 'b' is required and can't have a default value.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:49:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:51:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:49:29: Error: Named parameter 'b' is required and can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:51:29: Error: Named parameter 'b' is required and can't have a default value.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:52:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:54:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:53:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:55:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f2 = (int a = 42, [int b]) {};
// ^
@@ -74,7 +59,7 @@ class Class extends core::Object {
synthetic constructor •() → self::Class
: super core::Object::•()
;
method method({core::int a = #C1, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic {}
method method({core::int a = #C1, required core::int b, required covariant-by-declaration core::int c}) → dynamic {}
}
abstract class A extends core::Object {
synthetic constructor •() → self::A
@@ -95,7 +80,7 @@ class C extends self::A {
method foo({core::int x = #C1}) → dynamic {}
}
static field ({a: core::int, required b: core::int}) → dynamic field = ({core::int a = #C1, required core::int b}) → Null {};
static method method({core::int a = #C1, required core::int b, required final core::int c}) → dynamic {}
static method method({core::int a = #C1, required core::int b, required core::int c}) → dynamic {}
static method ok() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({core::int a = #C1, required core::int b}) → void {}
@@ -2,22 +2,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2.dart:5:46: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// method({int a = 42, required int b, required final int c}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:11:18: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required final int c,
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:12:28: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required covariant final int d}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:29:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:31:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
@@ -30,7 +15,7 @@ typedef Typedef2 = ({a: core::int, required b: core::int}) → dynamic;
class Class extends core::Object {
synthetic constructor •() → self::Class
;
method method({core::int a = 42, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic
method method({core::int a = 42, required core::int b, required covariant-by-declaration core::int c}) → dynamic
;
}
abstract class A extends core::Object {
@@ -51,7 +36,7 @@ class C extends self::A {
;
}
static field ({a: core::int, required b: core::int}) → dynamic field;
static method method({has-declared-initializer core::int a, required core::int b, required final core::int c}) → dynamic
static method method({has-declared-initializer core::int a, required core::int b, required core::int c}) → dynamic
;
static method ok() → dynamic
;
@@ -2,65 +2,50 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2.dart:5:46: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// method({int a = 42, required int b, required final int c}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:11:18: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required final int c,
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:12:28: Error: Can't have modifier 'final' here.
// Try removing 'final'.
// required covariant final int d}) {}
// ^^^^^
//
// pkg/front_end/testcases/nnbd/required_2.dart:29:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:31:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:51:18: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:53:18: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// Function(int a = 42, [int b]) f2;
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:52:17: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:54:17: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:53:15: Error: Non-optional parameters can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:55:15: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// f2 = (int a = 42, [int b]) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:48:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:50:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:48:31: Error: Named parameter 'b' is required and can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:50:31: Error: Named parameter 'b' is required and can't have a default value.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:49:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:51:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:49:29: Error: Named parameter 'b' is required and can't have a default value.
// pkg/front_end/testcases/nnbd/required_2.dart:51:29: Error: Named parameter 'b' is required and can't have a default value.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:52:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:54:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2.dart:53:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// pkg/front_end/testcases/nnbd/required_2.dart:55:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f2 = (int a = 42, [int b]) {};
// ^
@@ -74,7 +59,7 @@ class Class extends core::Object {
synthetic constructor •() → self::Class
: super core::Object::•()
;
method method({core::int a = #C1, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic {}
method method({core::int a = #C1, required core::int b, required covariant-by-declaration core::int c}) → dynamic {}
}
abstract class A extends core::Object {
synthetic constructor •() → self::A
@@ -95,7 +80,7 @@ class C extends self::A {
method foo({core::int x = #C1}) → dynamic {}
}
static field ({a: core::int, required b: core::int}) → dynamic field = ({core::int a = #C1, required core::int b}) → Null {};
static method method({core::int a = #C1, required core::int b, required final core::int c}) → dynamic {}
static method method({core::int a = #C1, required core::int b, required core::int c}) → dynamic {}
static method ok() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({core::int a = #C1, required core::int b}) → void {}
@@ -1,7 +1,7 @@
method({int a = 42, required int b, required final int c}) {}
method({int a = 42, required int b, required int c}) {}
class Class {
method( {int a = 42, required int b, required final int c, required covariant final int d}) {}
method({int a = 42, required int b, required covariant int c}) {}
}
typedef Typedef1 = Function({int a, required int b});
@@ -13,14 +13,14 @@ class C extends A {
}
class Class {
method( {int a = 42, required int b, required final int c, required covariant final int d}) {}
method({int a = 42, required int b, required covariant int c}) {}
}
error() {}
main() {}
method({int a = 42, required int b, required final int c}) {}
method({int a = 42, required int b, required int c}) {}
ok() {}
@@ -0,0 +1,59 @@
// Copyright (c) 2026, 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.
// Version prior to primary constructors, to allow `final` in parameters.
// @dart=3.11
method({int a = 42, required int b, required final int c}) {}
class Class {
method(
{int a = 42,
required int b,
required final int c,
required covariant final int d}) {}
}
// TODO(johnniwinther): Pass the required property to the function types.
typedef Typedef1 = Function({int a, required int b});
typedef Typedef2({int a, required int b});
Function({int a, required int b}) field = ({int a = 42, required int b}) {};
abstract class A {
// It's ok to omit the default values in abstract members.
foo({int x});
}
class B extends A {
// This is an implementation and it should have the default value.
foo({x}) {}
}
class C extends A {
foo({x = 42}) {}
}
ok() {
Function({int a, required int b}) f;
void g({int a = 42, required int b}) {}
f = ({int a = 42, required int b}) {};
Function(int a, [int b]) f2;
void g2(int a, [int b = 42]) {}
f2 = (int a, [int b = 42]) {};
}
error() {
Function({int a, required int b}) f;
void g({int a, required int b = 42}) {}
f = ({int a, required int b = 42}) {};
Function(int a = 42, [int b]) f2;
void g2(int a = 42, [int b]) {}
f2 = (int a = 42, [int b]) {};
}
main() {}
@@ -0,0 +1,105 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:32:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:54:18: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// Function(int a = 42, [int b]) f2;
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:55:17: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:56:15: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// f2 = (int a = 42, [int b]) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:51:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:51:31: Error: Named parameter 'b' is required and can't have a default value.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:52:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:52:29: Error: Named parameter 'b' is required and can't have a default value.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:55:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:56:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f2 = (int a = 42, [int b]) {};
// ^
//
import self as self;
import "dart:core" as core;
typedef Typedef1 = ({a: core::int, required b: core::int}) → dynamic;
typedef Typedef2 = ({a: core::int, required b: core::int}) → dynamic;
class Class extends core::Object {
synthetic constructor •() → self::Class
: super core::Object::•()
;
method method({core::int a = #C1, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic {}
}
abstract class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
abstract method foo({core::int x = #C2}) → dynamic;
}
class B extends self::A {
synthetic constructor •() → self::B
: super self::A::•()
;
method foo({erroneously-initialized core::int x = #C2}) → dynamic {}
}
class C extends self::A {
synthetic constructor •() → self::C
: super self::A::•()
;
method foo({core::int x = #C1}) → dynamic {}
}
static field ({a: core::int, required b: core::int}) → dynamic field = ({core::int a = #C1, required core::int b}) → Null {};
static method method({core::int a = #C1, required core::int b, required final core::int c}) → dynamic {}
static method ok() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({core::int a = #C1, required core::int b}) → void {}
f = ({core::int a = #C1, required core::int b}) → Null {};
(core::int, [core::int]) → dynamic f2;
function g2(core::int a, [core::int b = #C1]) → void {}
f2 = (core::int a, [core::int b = #C1]) → Null {};
}
static method error() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({erroneously-initialized core::int a = #C2, required core::int b = #C1}) → void {}
f = ({erroneously-initialized core::int a = #C2, required core::int b = #C1}) → Null {};
(core::int, [core::int]) → dynamic f2;
function g2(core::int a = #C1, [erroneously-initialized core::int b = #C2]) → void {}
f2 = (core::int a = #C1, [erroneously-initialized core::int b = #C2]) → Null {};
}
static method main() → dynamic {}
constants {
#C1 = 42
#C2 = null
}
@@ -0,0 +1,105 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:32:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:54:18: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// Function(int a = 42, [int b]) f2;
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:55:17: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:56:15: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// f2 = (int a = 42, [int b]) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:51:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:51:31: Error: Named parameter 'b' is required and can't have a default value.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:52:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:52:29: Error: Named parameter 'b' is required and can't have a default value.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:55:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:56:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f2 = (int a = 42, [int b]) {};
// ^
//
import self as self;
import "dart:core" as core;
typedef Typedef1 = ({a: core::int, required b: core::int}) → dynamic;
typedef Typedef2 = ({a: core::int, required b: core::int}) → dynamic;
class Class extends core::Object {
synthetic constructor •() → self::Class
: super core::Object::•()
;
method method({core::int a = #C1, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic {}
}
abstract class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
abstract method foo({core::int x = #C2}) → dynamic;
}
class B extends self::A {
synthetic constructor •() → self::B
: super self::A::•()
;
method foo({erroneously-initialized core::int x = #C2}) → dynamic {}
}
class C extends self::A {
synthetic constructor •() → self::C
: super self::A::•()
;
method foo({core::int x = #C1}) → dynamic {}
}
static field ({a: core::int, required b: core::int}) → dynamic field = ({core::int a = #C1, required core::int b}) → Null {};
static method method({core::int a = #C1, required core::int b, required final core::int c}) → dynamic {}
static method ok() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({core::int a = #C1, required core::int b}) → void {}
f = ({core::int a = #C1, required core::int b}) → Null {};
(core::int, [core::int]) → dynamic f2;
function g2(core::int a, [core::int b = #C1]) → void {}
f2 = (core::int a, [core::int b = #C1]) → Null {};
}
static method error() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({erroneously-initialized core::int a = #C2, required core::int b = #C1}) → void {}
f = ({erroneously-initialized core::int a = #C2, required core::int b = #C1}) → Null {};
(core::int, [core::int]) → dynamic f2;
function g2(core::int a = #C1, [erroneously-initialized core::int b = #C2]) → void {}
f2 = (core::int a = #C1, [erroneously-initialized core::int b = #C2]) → Null {};
}
static method main() → dynamic {}
constants {
#C1 = 42
#C2 = null
}
@@ -0,0 +1,46 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:32:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
//
import self as self;
import "dart:core" as core;
typedef Typedef1 = ({a: core::int, required b: core::int}) → dynamic;
typedef Typedef2 = ({a: core::int, required b: core::int}) → dynamic;
class Class extends core::Object {
synthetic constructor •() → self::Class
;
method method({core::int a = 42, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic
;
}
abstract class A extends core::Object {
synthetic constructor •() → self::A
;
abstract method foo({core::int x = null}) → dynamic;
}
class B extends self::A {
synthetic constructor •() → self::B
;
method foo({erroneously-initialized core::int x = null}) → dynamic
;
}
class C extends self::A {
synthetic constructor •() → self::C
;
method foo({core::int x = 42}) → dynamic
;
}
static field ({a: core::int, required b: core::int}) → dynamic field;
static method method({has-declared-initializer core::int a, required core::int b, required final core::int c}) → dynamic
;
static method ok() → dynamic
;
static method error() → dynamic
;
static method main() → dynamic
;
@@ -0,0 +1,105 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:32:8: Error: The parameter 'x' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// foo({x}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:54:18: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// Function(int a = 42, [int b]) f2;
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:55:17: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:56:15: Error: Non-optional parameters can't have a default value.
// Try removing the default value or making the parameter optional.
// f2 = (int a = 42, [int b]) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:51:15: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:51:31: Error: Named parameter 'b' is required and can't have a default value.
// void g({int a, required int b = 42}) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:52:13: Error: The parameter 'a' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:52:29: Error: Named parameter 'b' is required and can't have a default value.
// f = ({int a, required int b = 42}) {};
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:55:28: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// void g2(int a = 42, [int b]) {}
// ^
//
// pkg/front_end/testcases/nnbd/required_2_legacy.dart:56:26: Error: The parameter 'b' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'.
// Try adding either an explicit non-'null' default value or the 'required' modifier.
// f2 = (int a = 42, [int b]) {};
// ^
//
import self as self;
import "dart:core" as core;
typedef Typedef1 = ({a: core::int, required b: core::int}) → dynamic;
typedef Typedef2 = ({a: core::int, required b: core::int}) → dynamic;
class Class extends core::Object {
synthetic constructor •() → self::Class
: super core::Object::•()
;
method method({core::int a = #C1, required core::int b, required final core::int c, required covariant-by-declaration final core::int d}) → dynamic {}
}
abstract class A extends core::Object {
synthetic constructor •() → self::A
: super core::Object::•()
;
abstract method foo({core::int x = #C2}) → dynamic;
}
class B extends self::A {
synthetic constructor •() → self::B
: super self::A::•()
;
method foo({erroneously-initialized core::int x = #C2}) → dynamic {}
}
class C extends self::A {
synthetic constructor •() → self::C
: super self::A::•()
;
method foo({core::int x = #C1}) → dynamic {}
}
static field ({a: core::int, required b: core::int}) → dynamic field = ({core::int a = #C1, required core::int b}) → Null {};
static method method({core::int a = #C1, required core::int b, required final core::int c}) → dynamic {}
static method ok() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({core::int a = #C1, required core::int b}) → void {}
f = ({core::int a = #C1, required core::int b}) → Null {};
(core::int, [core::int]) → dynamic f2;
function g2(core::int a, [core::int b = #C1]) → void {}
f2 = (core::int a, [core::int b = #C1]) → Null {};
}
static method error() → dynamic {
({a: core::int, required b: core::int}) → dynamic f;
function g({erroneously-initialized core::int a = #C2, required core::int b = #C1}) → void {}
f = ({erroneously-initialized core::int a = #C2, required core::int b = #C1}) → Null {};
(core::int, [core::int]) → dynamic f2;
function g2(core::int a = #C1, [erroneously-initialized core::int b = #C2]) → void {}
f2 = (core::int a = #C1, [erroneously-initialized core::int b = #C2]) → Null {};
}
static method main() → dynamic {}
constants {
#C1 = 42
#C2 = null
}
@@ -0,0 +1,31 @@
// @dart = 3.11
method({int a = 42, required int b, required final int c}) {}
class Class {
method( {int a = 42, required int b, required final int c, required covariant final int d}) {}
}
typedef Typedef1 = Function({int a, required int b});
typedef Typedef2({int a, required int b});
Function({int a, required int b}) field = ({int a = 42, required int b}) {};
abstract class A {
foo({int x});
}
class B extends A {
foo({x}) {}
}
class C extends A {
foo({x = 42}) {}
}
ok() {}
error() {}
main() {}
@@ -0,0 +1,36 @@
// @dart = 3.11
Function({int a, required int b}) field = ({int a = 42, required int b}) {};
abstract class A {
foo({int x});
}
class B extends A {
foo({x}) {}
}
class C extends A {
foo({x = 42}) {}
}
class Class {
method({
int a = 42,
required int b,
required final int c,
required covariant final int d,
}) {}
}
error() {}
main() {}
method({int a = 42, required int b, required final int c}) {}
ok() {}
typedef Typedef1 = Function({int a, required int b});
typedef Typedef2({int a, required int b});
+4 -4
View File
@@ -444,7 +444,7 @@ CoverageInfo _process(
}
}
void addChunk(int from, final int to) {
void addChunk(int from, int to) {
if (addAndRemoveCommentsInFiles && removeFrom.isNotEmpty) {
int fromIndex = binarySearch(removeFrom, from);
if (removeFrom[fromIndex] < from && removeTo[fromIndex] < from) {
@@ -970,9 +970,9 @@ class AstIndexerAndIgnoreCollector extends AstIndexer {
/// If there is not it will add a note to add one if that makes sense (in that
/// there is possible coverage but no actual coverage).
bool _checkCommentAndIgnoreCoverageWithBeginAndEnd(
final Token tokenWithPossibleComment,
final Token beginToken,
final Token endToken, {
Token tokenWithPossibleComment,
Token beginToken,
Token endToken, {
required bool allowReplace,
bool isBlock = false,
bool allowOnBraceStart = false,
+1 -1
View File
@@ -10,7 +10,7 @@ import '../test/vm_service_helper.dart';
Uri? coverageUri;
Future<void> main(final List<String> args) async {
Future<void> main(List<String> args) async {
String? coverage = Platform.environment["CFE_COVERAGE"];
if (coverage != null) {
coverageUri = Uri.base.resolveUri(Uri.file(coverage));
@@ -57,7 +57,7 @@ typedef CachedDillAndCompilerOptionsPaths = ({
/// Returns the absolute paths to the cached kernel file and the cached compiler
/// options file associated with [canonicalizedLibraryPath].
CachedDillAndCompilerOptionsPaths computeCachedDillAndCompilerOptionsPaths(
final String canonicalizedLibraryPath,
String canonicalizedLibraryPath,
) {
final String dirname = path.dirname(canonicalizedLibraryPath);
final String basename = path.basename(canonicalizedLibraryPath);
@@ -368,9 +368,9 @@ class ResidentFrontendServer {
/// entrypoint. This function also writes [compileOptions.arguments] to
/// [cachedCompilerOptions] as a JSON list.
static ResidentCompiler _getResidentCompilerForEntrypoint({
required final String canonicalizedLibraryPath,
required final ArgResults compileOptions,
required final File cachedCompilerOptions,
required String canonicalizedLibraryPath,
required ArgResults compileOptions,
required File cachedCompilerOptions,
}) {
cachedCompilerOptions.createSync();
cachedCompilerOptions.writeAsStringSync(
+2 -2
View File
@@ -196,7 +196,7 @@ class JsBuilder {
/// [arguments] can be a single [Node] (e.g. an [Expression] or [Statement])
/// or a list of [Node]s, which will be interpolated into the source at the
/// '#' signs.
Expression call(String source, [var arguments]) {
Expression call(String source, [arguments]) {
Template template = _findExpressionTemplate(source);
arguments ??= [];
// We allow a single argument to be given directly.
@@ -205,7 +205,7 @@ class JsBuilder {
}
/// Parses a JavaScript Statement, otherwise just like [call].
Statement statement(String source, [var arguments]) {
Statement statement(String source, [arguments]) {
Template template = _findStatementTemplate(source);
arguments ??= [];
// We allow a single argument to be given directly.
+1 -1
View File
@@ -38,7 +38,7 @@ void main(args) {
}
class WrappedBinaryBuilder extends BinaryBuilder {
WrappedBinaryBuilder(var _bytes) : super(_bytes, disableLazyReading: true);
WrappedBinaryBuilder(_bytes) : super(_bytes, disableLazyReading: true);
int offsetsSize = 0;
int stringTableSize = 0;
int linkTableSize = 0;
+1 -1
View File
@@ -157,7 +157,7 @@ class WrappedBinaryBuilder extends BinaryBuilder {
List<int> statementTypes = List<int>.filled(255, 0);
List<int> typeTypes = List<int>.filled(255, 0);
WrappedBinaryBuilder(var _bytes)
WrappedBinaryBuilder(_bytes)
: super(
_bytes,
disableLazyReading: true,
+1 -1
View File
@@ -1657,7 +1657,7 @@ class _SnapshotGraph implements SnapshotGraph {
var workStack = _newUint32Array(N);
var workStackTop = 0;
mergeChildrenAndSort(var parent1, var end) {
mergeChildrenAndSort(parent1, end) {
assert(parent1 != _SENTINEL);
if (next[parent1] == end) return;
+2 -2
View File
@@ -30,7 +30,7 @@ class SortedTable {
SortedTable(this.columns);
int _sortColumnIndex = 0;
set sortColumnIndex(var index) {
set sortColumnIndex(index) {
assert(index >= 0);
assert(index < columns.length);
_sortColumnIndex = index;
@@ -39,7 +39,7 @@ class SortedTable {
int get sortColumnIndex => _sortColumnIndex;
bool _sortDescending = true;
bool get sortDescending => _sortDescending;
set sortDescending(var descending) {
set sortDescending(descending) {
_sortDescending = descending;
}
@@ -91,7 +91,7 @@ class NavReloadElement extends CustomElement implements Renderable {
} else {
final List<HTMLElement> content = _isolates.reloadSourcesServices
.map(
(final s) =>
(s) =>
(new HTMLLIElement()..appendChild(
new HTMLButtonElement()
..textContent = s.alias
@@ -965,7 +965,7 @@ class ScriptInsetElement extends CustomElement implements Renderable {
}
var position = 0;
consumeUntil(var stop) {
consumeUntil(stop) {
if (stop <= position) {
return null; // Empty gap between annotations/boundaries.
}
+3 -3
View File
@@ -2065,12 +2065,12 @@ class Isolate extends ServiceObjectOwner implements M.Isolate {
return invokeRpc('_getRetainedSize', params);
}
Future<ServiceObject> getRetainingPath(ServiceObject target, var limit) {
Future<ServiceObject> getRetainingPath(ServiceObject target, limit) {
Map params = {'targetId': target.id, 'limit': limit.toString()};
return invokeRpc('getRetainingPath', params);
}
Future<ServiceObject> getInboundReferences(ServiceObject target, var limit) {
Future<ServiceObject> getInboundReferences(ServiceObject target, limit) {
Map params = {'targetId': target.id, 'limit': limit.toString()};
return invokeRpc('getInboundReferences', params);
}
@@ -2080,7 +2080,7 @@ class Isolate extends ServiceObjectOwner implements M.Isolate {
return invokeRpc('_getTypeArgumentsList', params);
}
Future<ServiceObject> getInstances(Class cls, var limit) {
Future<ServiceObject> getInstances(Class cls, limit) {
Map params = {'objectId': cls.id, 'limit': limit.toString()};
return invokeRpc('getInstances', params);
}
+2 -3
View File
@@ -243,7 +243,7 @@ class TestingServers {
void _handleUploadRequest(HttpRequest request) async {
try {
var builder = await request.fold(BytesBuilder(), (dynamic b, var d) {
var builder = await request.fold(BytesBuilder(), (dynamic b, d) {
b.add(d);
return b;
});
@@ -368,8 +368,7 @@ class TestingServers {
// of policies via js-interop, and is tested by
// tests/lib/js/static_interop_test/import/import_trustedscripturl_test
"require-trusted-types-for: 'script'",
"trusted-types dart.deferred-loading scriptUrl"
,
"trusted-types dart.deferred-loading scriptUrl",
].join('; ');
for (var header in [
"Content-Security-Policy",
@@ -1,4 +1,4 @@
bool isPrime(var n) {
bool isPrime(n) {
if (n < 2) return false;
for (var i = 2; i * i <= n; i++) {
if (n % i == 0) return false;
@@ -33,13 +33,13 @@ class C4 {
extension type SomeExtensionType(int foo) {}
class Run<T> {
void execute(final List<T> list) {
void execute(List<T> list) {
// Should be unchecked.
}
}
void testTypeCheckRemoval() {
final list = List.generate(10, (final a) => SomeExtensionType(a));
final list = List.generate(10, (a) => SomeExtensionType(a));
final obj = Run<SomeExtensionType>();
obj.execute(list);
}
@@ -22,7 +22,7 @@ class Run<T extends core::Object? = dynamic> extends core::Object {
[@vm.inferred-return-type.metadata=dart.core::Null? (value: null)]
[@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:3,getterSelectorId:4]
method execute([@vm.inferred-arg-type.metadata=dart.core::_GrowableList<dart.core::int> (skip check)] covariant-by-class final core::List<self::Run::T%> list) → void {}
method execute([@vm.inferred-arg-type.metadata=dart.core::_GrowableList<dart.core::int> (skip check)] covariant-by-class core::List<self::Run::T%> list) → void {}
}
abstract class C5<T extends core::Object? = dynamic> extends core::Object {
}
@@ -63,7 +63,7 @@ static extension-type-member method SomeExtensionType|constructor#([@vm.inferred
[@vm.inferred-return-type.metadata=dart.core::Null? (value: null)]
static method testTypeCheckRemoval() → void {
final core::List<self::SomeExtensionType% /* erasure=core::int, declared=! */> list = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] core::_GrowableList::generate<self::SomeExtensionType% /* erasure=core::int, declared=! */>(10, (final core::int a) → self::SomeExtensionType% /* erasure=core::int, declared=! */ => [@vm.inferred-type.metadata=int] self::SomeExtensionType|constructor#(a));
final core::List<self::SomeExtensionType% /* erasure=core::int, declared=! */> list = [@vm.inferred-type.metadata=dart.core::_GrowableList<dart.core::int>] core::_GrowableList::generate<self::SomeExtensionType% /* erasure=core::int, declared=! */>(10, (core::int a) → self::SomeExtensionType% /* erasure=core::int, declared=! */ => [@vm.inferred-type.metadata=int] self::SomeExtensionType|constructor#(a));
final self::Run<self::SomeExtensionType% /* erasure=core::int, declared=! */> obj = new self::Run::•<self::SomeExtensionType% /* erasure=core::int, declared=! */>();
[@vm.call-site-attributes.metadata=receiverType:#lib::Run<#lib::SomeExtensionType>] [@vm.direct-call.metadata=#lib::Run.execute] [@vm.inferred-type.metadata=? (skip check)] obj.{self::Run::execute}(list){(core::List<self::SomeExtensionType% /* erasure=core::int, declared=! */>) → void};
}
@@ -23,7 +23,7 @@ class Point {
Point newPoint2() => new Point(x);
}
getX(var point) {
getX(point) {
point.x;
}
+4 -4
View File
@@ -46,15 +46,15 @@ Future func10() async {
}
void expectFrame(
final frame,
final kindExpectation,
final codeNameExpectation,
frame,
kindExpectation,
codeNameExpectation,
) {
expect(frame.kind, kindExpectation);
expect(frame.code?.name, codeNameExpectation);
}
void expectFrames(final frames, final expectKindAndCodeName) {
void expectFrames(frames, expectKindAndCodeName) {
for (int i = 0; i < expectKindAndCodeName.length; i++) {
expectFrame(
frames[i],