Skip to content

Commit a25f8e5

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Extensions are always enabled, merge corresponding tests.
Change-Id: I2a2603ea506baaf95ce26da656cee965faf094c2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149608 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 2c5739b commit a25f8e5

12 files changed

+392
-489
lines changed

pkg/analyzer/test/generated/parser_fasta_test.dart

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,21 +1648,6 @@ class ExpressionParserTest_Fasta extends FastaParserTestCase
16481648

16491649
@reflectiveTest
16501650
class ExtensionMethodsParserTest_Fasta extends FastaParserTestCase {
1651-
@override
1652-
CompilationUnit parseCompilationUnit(String content,
1653-
{List<ErrorCode> codes,
1654-
List<ExpectedError> errors,
1655-
FeatureSet featureSet}) {
1656-
return super.parseCompilationUnit(content,
1657-
codes: codes,
1658-
errors: errors,
1659-
featureSet: featureSet ??
1660-
FeatureSet.forTesting(
1661-
sdkVersion: '2.3.0',
1662-
additionalFeatures: [Feature.extension_methods],
1663-
));
1664-
}
1665-
16661651
void test_complex_extends() {
16671652
var unit = parseCompilationUnit(
16681653
'extension E extends A with B, C implements D { }',
@@ -2723,28 +2708,6 @@ main() {
27232708
parseCompilationUnit('D? foo(X? x) { X? x1; X? x2 = x; }');
27242709
}
27252710

2726-
void test_bangQuestionIndex() {
2727-
// http://dartbug.com/41177
2728-
CompilationUnit unit = parseCompilationUnit('f(dynamic a) { a!?[0]; }');
2729-
FunctionDeclaration funct = unit.declarations[0];
2730-
BlockFunctionBody body = funct.functionExpression.body;
2731-
2732-
ExpressionStatement statement = body.block.statements[0];
2733-
IndexExpression expression = statement.expression;
2734-
2735-
IntegerLiteral index = expression.index;
2736-
expect(index.value, 0);
2737-
2738-
Token question = expression.question;
2739-
expect(question, isNotNull);
2740-
expect(question.lexeme, "?");
2741-
2742-
PostfixExpression target = expression.target;
2743-
SimpleIdentifier identifier = target.operand;
2744-
expect(identifier.name, 'a');
2745-
expect(target.operator.lexeme, '!');
2746-
}
2747-
27482711
void test_bangBeforeFuctionCall1() {
27492712
// https://github.com/dart-lang/sdk/issues/39776
27502713
var unit = parseCompilationUnit('f() { Function? f1; f1!(42); }');
@@ -2797,6 +2760,28 @@ main() {
27972760
expect(argument.value, 42);
27982761
}
27992762

2763+
void test_bangQuestionIndex() {
2764+
// http://dartbug.com/41177
2765+
CompilationUnit unit = parseCompilationUnit('f(dynamic a) { a!?[0]; }');
2766+
FunctionDeclaration funct = unit.declarations[0];
2767+
BlockFunctionBody body = funct.functionExpression.body;
2768+
2769+
ExpressionStatement statement = body.block.statements[0];
2770+
IndexExpression expression = statement.expression;
2771+
2772+
IntegerLiteral index = expression.index;
2773+
expect(index.value, 0);
2774+
2775+
Token question = expression.question;
2776+
expect(question, isNotNull);
2777+
expect(question.lexeme, "?");
2778+
2779+
PostfixExpression target = expression.target;
2780+
SimpleIdentifier identifier = target.operand;
2781+
expect(identifier.name, 'a');
2782+
expect(target.operator.lexeme, '!');
2783+
}
2784+
28002785
void test_binary_expression_statement() {
28012786
final unit = parseCompilationUnit('D? foo(X? x) { X ?? x2; }');
28022787
FunctionDeclaration funct = unit.declarations[0];

0 commit comments

Comments
 (0)