Skip to content

Commit

Permalink
Version 3.6.0-115.0.dev
Browse files Browse the repository at this point in the history
Merge f36c714 into dev
  • Loading branch information
Dart CI committed Aug 5, 2024
2 parents d4a2c6a + f36c714 commit bdeaec1
Show file tree
Hide file tree
Showing 207 changed files with 4,906 additions and 92 deletions.
36 changes: 0 additions & 36 deletions pkg/front_end/lib/src/kernel/body_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ class BodyBuilder extends StackListenerImpl
switchScope.unclaimedForwardDeclarations!
.forEach((String name, JumpTarget declaration) {
if (outerSwitchScope == null) {
// Coverage-ignore-block(suite): Not run.
for (Statement statement in declaration.users) {
statement.parent!.replaceChild(
statement,
Expand All @@ -745,7 +744,6 @@ class BodyBuilder extends StackListenerImpl
buildProblem(message, offset, name.length, context: context)
..parent = variable;
} else {
// Coverage-ignore-block(suite): Not run.
variable.initializer = wrapInLocatedProblem(
variable.initializer!, message.withLocation(uri, offset, name.length),
context: context)
Expand Down Expand Up @@ -1043,7 +1041,6 @@ class BodyBuilder extends StackListenerImpl
if (formal.isInitializingFormal) {
List<Initializer> initializers;
if (_context.isExternalConstructor) {
// Coverage-ignore-block(suite): Not run.
initializers = <Initializer>[
buildInvalidInitializer(
buildProblem(
Expand Down Expand Up @@ -2180,7 +2177,6 @@ class BodyBuilder extends StackListenerImpl
debugEvent("ParenthesizedExpression");
Expression value = popForValue();
if (value is ShadowLargeIntLiteral) {
// Coverage-ignore-block(suite): Not run.
// We need to know that the expression was parenthesized because we will
// treat -n differently from -(n). If the expression occurs in a double
// context, -n is a double literal and -(n) is an application of unary- to
Expand Down Expand Up @@ -2676,7 +2672,6 @@ class BodyBuilder extends StackListenerImpl
token.charOffset,
token.length));
} else {
// Coverage-ignore-block(suite): Not run.
push(buildProblem(fasta.templateInvalidOperator.withArguments(token),
token.charOffset, token.length));
}
Expand Down Expand Up @@ -3295,7 +3290,6 @@ class BodyBuilder extends StackListenerImpl
// Coverage-ignore-block(suite): Not run.
push(qualifier);
} else if (node is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
push(node);
} else {
Identifier identifier = node as Identifier;
Expand Down Expand Up @@ -3630,7 +3624,6 @@ class BodyBuilder extends StackListenerImpl
void pushNewLocalVariable(Expression? initializer, {Token? equalsToken}) {
Object? node = pop();
if (node is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
push(node);
return;
}
Expand Down Expand Up @@ -3694,7 +3687,6 @@ class BodyBuilder extends StackListenerImpl
debugEvent("NoFieldInitializer");
constantContext = _context.constantContext;
if (constantContext == ConstantContext.inferred) {
// Coverage-ignore-block(suite): Not run.
// Creating a null value to prevent the Dart VM from crashing.
push(forest.createNullLiteral(offsetForToken(token)));
} else {
Expand All @@ -3709,7 +3701,6 @@ class BodyBuilder extends StackListenerImpl
debugEvent("InitializedIdentifier");
Object? node = pop();
if (node is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
push(node);
return;
}
Expand Down Expand Up @@ -3757,7 +3748,6 @@ class BodyBuilder extends StackListenerImpl
currentLocalVariableModifiers = pop() as int;
List<Expression>? annotations = pop() as List<Expression>?;
if (node is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
push(node);
return;
}
Expand Down Expand Up @@ -3791,7 +3781,6 @@ class BodyBuilder extends StackListenerImpl
currentLocalVariableModifiers = pop() as int;
List<Expression>? annotations = pop() as List<Expression>?;
if (variables == null) {
// Coverage-ignore-block(suite): Not run.
push(new ParserRecovery(offsetForToken(endToken)));
return;
}
Expand Down Expand Up @@ -3921,7 +3910,6 @@ class BodyBuilder extends StackListenerImpl

void exitLoopOrSwitch(Statement statement) {
if (problemInLoopOrSwitch != null) {
// Coverage-ignore-block(suite): Not run.
push(problemInLoopOrSwitch);
problemInLoopOrSwitch = null;
} else {
Expand Down Expand Up @@ -3964,7 +3952,6 @@ class BodyBuilder extends StackListenerImpl
// Coverage-ignore-block(suite): Not run.
return <VariableDeclaration>[];
} else if (variableOrExpression is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
return <VariableDeclaration>[];
} else if (variableOrExpression == null) {
return <VariableDeclaration>[];
Expand Down Expand Up @@ -4280,7 +4267,6 @@ class BodyBuilder extends StackListenerImpl
<Statement>[variableOrExpression, ...intermediateVariables!, result]);
}
if (variableOrExpression is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
problemInLoopOrSwitch ??= buildProblemStatement(
fasta.messageSyntheticToken, variableOrExpression.charOffset,
suppressMessage: true);
Expand Down Expand Up @@ -4350,7 +4336,6 @@ class BodyBuilder extends StackListenerImpl
DartType typeArgument;
if (typeArguments != null) {
if (typeArguments.length > 1) {
// Coverage-ignore-block(suite): Not run.
addProblem(
fasta.messageListLiteralTooManyTypeArguments,
offsetForToken(leftBracket),
Expand Down Expand Up @@ -4556,7 +4541,6 @@ class BodyBuilder extends StackListenerImpl
if (setOrMapEntries != null) {
for (dynamic entry in setOrMapEntries) {
if (entry is MapLiteralEntry) {
// Coverage-ignore-block(suite): Not run.
// TODO(danrubel): report the error on the colon
addProblem(fasta.templateExpectedButGot.withArguments(','),
entry.fileOffset, 1);
Expand Down Expand Up @@ -4849,7 +4833,6 @@ class BodyBuilder extends StackListenerImpl
if (identifierCount == 1) {
Object? part = pop();
if (part is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
push(new ParserErrorGenerator(
this, hashToken, fasta.messageSyntheticToken));
} else {
Expand Down Expand Up @@ -5255,7 +5238,6 @@ class BodyBuilder extends StackListenerImpl
debugEvent("ThrowExpression");
Expression expression = popForValue();
if (constantContext != ConstantContext.none) {
// Coverage-ignore-block(suite): Not run.
push(buildProblem(
fasta.templateNotConstantExpression.withArguments('Throw'),
throwToken.offset,
Expand Down Expand Up @@ -6222,7 +6204,6 @@ class BodyBuilder extends StackListenerImpl
List<TypeBuilder>? typeArguments = pop() as List<TypeBuilder>?;
if (inMetadata && typeArguments != null) {
if (!libraryFeatures.genericMetadata.isEnabled) {
// Coverage-ignore-block(suite): Not run.
handleRecoverableError(fasta.messageMetadataTypeArguments,
nameLastToken.next!, nameLastToken.next!);
}
Expand All @@ -6241,7 +6222,6 @@ class BodyBuilder extends StackListenerImpl
typeArguments, name, arguments, nameToken, nameLastToken, constness,
inImplicitCreationContext: inImplicitCreationContext));
} else if (type is ParserRecovery) {
// Coverage-ignore-block(suite): Not run.
push(new ParserErrorGenerator(
this, nameToken, fasta.messageSyntheticToken));
} else if (type is InvalidExpression) {
Expand Down Expand Up @@ -6359,7 +6339,6 @@ class BodyBuilder extends StackListenerImpl
int numberOfTypeArguments = typeArguments?.length ?? 0;
if (typeArguments != null &&
numberOfTypeParameters != numberOfTypeArguments) {
// Coverage-ignore-block(suite): Not run.
// TODO(eernst): Use position of type arguments, not nameToken.
return evaluateArgumentsBefore(
arguments,
Expand Down Expand Up @@ -6396,7 +6375,6 @@ class BodyBuilder extends StackListenerImpl
target = null;
} else if (constructorBuilder.isConstructor) {
if (typeDeclarationBuilder.isAbstract) {
// Coverage-ignore-block(suite): Not run.
return evaluateArgumentsBefore(
arguments,
buildAbstractClassInstantiationError(
Expand Down Expand Up @@ -6592,7 +6570,6 @@ class BodyBuilder extends StackListenerImpl
forest.argumentsSetTypeArguments(arguments, []);
} else {
if (forest.argumentsTypeArguments(arguments).isEmpty) {
// Coverage-ignore-block(suite): Not run.
// No type arguments provided to unaliased class, use defaults.
List<DartType> result = new List<DartType>.generate(
typeVariables.length,
Expand Down Expand Up @@ -6995,7 +6972,6 @@ class BodyBuilder extends StackListenerImpl
// TODO(cstefantsova): Replace the following no-op with the node for
// handling null-aware elements.
if (!libraryFeatures.nullAwareElements.isEnabled) {
// Coverage-ignore-block(suite): Not run.
addProblem(
templateExperimentNotEnabledOffByDefault
.withArguments(ExperimentalFlag.nullAwareElements.name),
Expand Down Expand Up @@ -7631,7 +7607,6 @@ class BodyBuilder extends StackListenerImpl
JumpTarget breakTarget = exitBreakTarget()!;
List<BreakStatementImpl>? continueStatements;
if (continueTarget.hasUsers) {
// Coverage-ignore-block(suite): Not run.
LabeledStatement labeledStatement = forest.createLabeledStatement(body);
continueStatements =
continueTarget.resolveContinues(forest, labeledStatement);
Expand Down Expand Up @@ -7662,7 +7637,6 @@ class BodyBuilder extends StackListenerImpl
typeInferrer.assignedVariables
.storeInfo(forInStatement, assignedVariablesNodeInfo);
if (continueStatements != null) {
// Coverage-ignore-block(suite): Not run.
for (BreakStatementImpl continueStatement in continueStatements) {
continueStatement.targetStatement = forInStatement;
}
Expand Down Expand Up @@ -7755,7 +7729,6 @@ class BodyBuilder extends StackListenerImpl
push(forest.createRethrowStatement(
offsetForToken(rethrowToken), offsetForToken(endToken)));
} else {
// Coverage-ignore-block(suite): Not run.
push(new ExpressionStatement(buildProblem(fasta.messageRethrowNotCatch,
offsetForToken(rethrowToken), lengthForToken(rethrowToken)))
..fileOffset = offsetForToken(rethrowToken));
Expand Down Expand Up @@ -7981,7 +7954,6 @@ class BodyBuilder extends StackListenerImpl
if (_labelScope.hasLocalLabel(labelName)) {
// TODO(ahe): Should validate this is a goto target.
if (!_labelScope.claimLabel(labelName)) {
// Coverage-ignore-block(suite): Not run.
addProblem(
fasta.templateDuplicateLabelInSwitchStatement
.withArguments(labelName),
Expand Down Expand Up @@ -8589,14 +8561,12 @@ class BodyBuilder extends StackListenerImpl
push(problemInLoopOrSwitch = buildProblemStatement(
fasta.messageBreakOutsideOfLoop, breakKeyword.charOffset));
} else if (target == null || !target.isBreakTarget) {
// Coverage-ignore-block(suite): Not run.
Token labelToken = breakKeyword.next!;
push(problemInLoopOrSwitch = buildProblemStatement(
fasta.templateInvalidBreakTarget.withArguments(name!),
labelToken.charOffset,
length: labelToken.length));
} else if (target.functionNestingLevel != functionNestingLevel) {
// Coverage-ignore-block(suite): Not run.
push(buildProblemTargetOutsideLocalFunction(name, breakKeyword));
} else {
Statement statement =
Expand All @@ -8606,7 +8576,6 @@ class BodyBuilder extends StackListenerImpl
}
}

// Coverage-ignore(suite): Not run.
Statement buildProblemTargetOutsideLocalFunction(
String? name, Token keyword) {
Statement problem;
Expand Down Expand Up @@ -8661,19 +8630,16 @@ class BodyBuilder extends StackListenerImpl
}
}
if (target == null) {
// Coverage-ignore-block(suite): Not run.
push(problemInLoopOrSwitch = buildProblemStatement(
fasta.messageContinueWithoutLabelInCase, continueKeyword.charOffset,
length: continueKeyword.length));
} else if (!target.isContinueTarget) {
// Coverage-ignore-block(suite): Not run.
Token labelToken = continueKeyword.next!;
push(problemInLoopOrSwitch = buildProblemStatement(
fasta.templateInvalidContinueTarget.withArguments(name!),
labelToken.charOffset,
length: labelToken.length));
} else if (target.functionNestingLevel != functionNestingLevel) {
// Coverage-ignore-block(suite): Not run.
push(buildProblemTargetOutsideLocalFunction(name, continueKeyword));
} else {
Statement statement = forest.createContinueStatement(
Expand Down Expand Up @@ -8895,7 +8861,6 @@ class BodyBuilder extends StackListenerImpl
context: context, suppressMessage: suppressMessage));
}

// Coverage-ignore(suite): Not run.
Statement wrapInProblemStatement(Statement statement, Message message) {
// TODO(askesc): Produce explicit error statement wrapping the original.
// See [issue 29717](https://github.com/dart-lang/sdk/issues/29717)
Expand Down Expand Up @@ -9020,7 +8985,6 @@ class BodyBuilder extends StackListenerImpl
DartType fieldType = _context.substituteFieldType(builder.fieldType);
if (!typeEnvironment.isSubtypeOf(
formalType, fieldType, SubtypeCheckMode.withNullabilities)) {
// Coverage-ignore-block(suite): Not run.
libraryBuilder.addProblem(
fasta.templateInitializingFormalTypeMismatch
.withArguments(name, formalType, builder.fieldType),
Expand Down
1 change: 0 additions & 1 deletion pkg/front_end/lib/src/source/source_field_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ class SourceFieldBuilder extends SourceMemberBuilderImpl
hasBodyBeenBuilt = true;
if (!hasInitializer &&
initializer != null &&
// Coverage-ignore(suite): Not run.
initializer is! NullLiteral &&
// Coverage-ignore(suite): Not run.
!isConst &&
Expand Down
3 changes: 0 additions & 3 deletions pkg/front_end/lib/src/type_inference/inference_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2224,7 +2224,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase

int? intValue = node.asInt64();
if (intValue == null) {
// Coverage-ignore-block(suite): Not run.
Expression replacement = helper.buildProblem(
templateIntegerLiteralIsOutOfRange.withArguments(node.literal),
node.fileOffset,
Expand Down Expand Up @@ -2815,7 +2814,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
inferredConditionTypes);
}
if (otherwise is ControlFlowElement) {
// Coverage-ignore-block(suite): Not run.
checkElement(otherwise, item, typeArgument, inferredSpreadTypes,
inferredConditionTypes);
}
Expand Down Expand Up @@ -9841,7 +9839,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
}
int? intValue = receiver.asInt64(negated: true);
if (intValue == null) {
// Coverage-ignore-block(suite): Not run.
Expression error = helper.buildProblem(
templateIntegerLiteralIsOutOfRange
.withArguments(receiver.literal),
Expand Down
8 changes: 4 additions & 4 deletions pkg/front_end/test/coverage_suite_expected.dart
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
),
// 100.0%.
"package:front_end/src/kernel/body_builder.dart": (
hitCount: 6831,
hitCount: 6992,
missCount: 0,
),
// 100.0%.
Expand All @@ -490,7 +490,7 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
),
// 100.0%.
"package:front_end/src/kernel/collections.dart": (
hitCount: 326,
hitCount: 329,
missCount: 0,
),
// 100.0%.
Expand Down Expand Up @@ -836,7 +836,7 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
),
// 100.0%.
"package:front_end/src/source/source_field_builder.dart": (
hitCount: 1180,
hitCount: 1181,
missCount: 0,
),
// 100.0%.
Expand Down Expand Up @@ -911,7 +911,7 @@ const Map<String, ({int hitCount, int missCount})> _expect = {
),
// 100.0%.
"package:front_end/src/type_inference/inference_visitor.dart": (
hitCount: 8044,
hitCount: 8081,
missCount: 0,
),
// 100.0%.
Expand Down
8 changes: 8 additions & 0 deletions pkg/front_end/testcases/coverage/bad_literal_symbol.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2024, 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.

void foo() {
print(#Bla); // OK
print(#!); // Error
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
library;
//
// Problems in library:
//
// pkg/front_end/testcases/coverage/bad_literal_symbol.dart:7:10: Error: Expected an identifier, but got '!'.
// Try inserting an identifier before '!'.
// print(#!); // Error
// ^
//
import self as self;
import "dart:core" as core;

static method foo() → void {
core::print(#C1);
core::print(invalid-expression "pkg/front_end/testcases/coverage/bad_literal_symbol.dart:7:9: Error: This couldn't be parsed.
print(#!); // Error
^"!);
}

constants {
#C1 = #Bla
}
Loading

0 comments on commit bdeaec1

Please sign in to comment.