Version 2.0.0-dev.42.0
Merge commit '96b76aa4fb0a5290193f14de14f0cc087e02cf32' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3db5bcd..d4b346a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## 2.0.0-dev.41.0
+## 2.0.0-dev.42.0
### Tool Changes
@@ -17,6 +17,10 @@
[pub#1826]: https://github.com/dart-lang/pub/issues/1826
[pub#1827]: https://github.com/dart-lang/pub/issues/1827
+## 2.0.0-dev.41.0
+
+Not released, due to a failure in the pub tool.
+
## 2.0.0-dev.40.0
### Core library changes
diff --git a/DEPS b/DEPS
index 35dcf73..21cf9a2 100644
--- a/DEPS
+++ b/DEPS
@@ -92,7 +92,7 @@
"http_io_tag": "@35dc43c9144cf7ed4236843dacd62ebaf89df21a",
"http_multi_server_tag" : "@2.0.4",
"http_parser_tag" : "@3.1.1",
- "http_retry_tag": "@0.1.0",
+ "http_retry_tag": "@0.1.1",
"http_tag" : "@0.11.3+16",
"http_throttle_tag" : "@1.0.1",
"idl_parser_rev": "@5fb1ebf49d235b5a70c9f49047e83b0654031eb7",
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 5c6e63d..43a1d47 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -326,9 +326,6 @@
/**
* The current analysis session.
- *
- * TODO(brianwilkerson) Create a new session when the current session might
- * produce inconsistent results.
*/
AnalysisSessionImpl _currentSession;
@@ -356,7 +353,7 @@
_sourceFactory = sourceFactory.clone(),
_sdkBundle = sdkBundle,
_externalSummaries = externalSummaries {
- _currentSession = new AnalysisSessionImpl(this);
+ _createNewSession();
_onResults = _resultController.stream.asBroadcastStream();
_testView = new AnalysisDriverTestView(this);
_createFileTracker();
@@ -1122,6 +1119,7 @@
* of state.
*/
void _changeHook() {
+ _createNewSession();
_priorityResults.clear();
_scheduler.notify(this);
}
@@ -1387,6 +1385,13 @@
}
/**
+ * Create a new analysis session, so invalidating the current one.
+ */
+ void _createNewSession() {
+ _currentSession = new AnalysisSessionImpl(this);
+ }
+
+ /**
* Fill [_salt] with data.
*/
void _fillSalt() {
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index fb9d1c0..fe720a6 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -135,42 +135,6 @@
super.test_expectedStringLiteral();
}
- @override
- @failingTest
- void test_getterInFunction_block_noReturnType() {
- // TODO(brianwilkerson) Does not recover.
- // type 'ExpressionStatementImpl' is not a subtype of type 'FunctionDeclarationStatement' of 'statement' where
- // ExpressionStatementImpl is from package:analyzer/src/dart/ast/ast.dart
- // FunctionDeclarationStatement is from package:analyzer/dart/ast/ast.dart
- //
- // test/generated/parser_test.dart 3019:9 FastaParserTestCase&ErrorParserTestMixin.test_getterInFunction_block_noReturnType
- super.test_getterInFunction_block_noReturnType();
- }
-
- @override
- @failingTest
- void test_getterInFunction_block_returnType() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.GETTER_IN_FUNCTION, found 0
- super.test_getterInFunction_block_returnType();
- }
-
- @override
- @failingTest
- void test_getterInFunction_expression_noReturnType() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.GETTER_IN_FUNCTION, found 0
- super.test_getterInFunction_expression_noReturnType();
- }
-
- @override
- @failingTest
- void test_getterInFunction_expression_returnType() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.GETTER_IN_FUNCTION, found 0
- super.test_getterInFunction_expression_returnType();
- }
-
void test_getterNativeWithBody() {
createParser('String get m native "str" => 0;');
parser.parseClassMember('C') as MethodDeclaration;
@@ -496,35 +460,8 @@
}
@override
- @failingTest
void test_method_invalidTypeParameterComments() {
- // TODO(brianwilkerson) Does not recover.
- // type 'DeclaredSimpleIdentifier' is not a subtype of type 'TypeAnnotation' of 'returnType' where
- // DeclaredSimpleIdentifier is from package:analyzer/src/dart/ast/ast.dart
- // TypeAnnotation is from package:analyzer/dart/ast/ast.dart
- //
- // package:analyzer/src/fasta/ast_builder.dart 1620:33 AstBuilder.endMethod
- // test/generated/parser_fasta_listener.dart 926:14 ForwardingTestListener.endMethod
- // package:front_end/src/fasta/parser/parser.dart 2433:14 Parser.parseMethod
- // package:front_end/src/fasta/parser/parser.dart 2323:11 Parser.parseMember
- // test/generated/parser_fasta_test.dart 3438:39 ParserProxy._run
- super.test_method_invalidTypeParameterComments();
- }
-
- @override
- @failingTest
- void test_method_invalidTypeParameterExtends() {
- // TODO(brianwilkerson) Does not recover.
- // type 'FormalParameterListImpl' is not a subtype of type 'TypeParameterList' of 'typeParameters' where
- // FormalParameterListImpl is from package:analyzer/src/dart/ast/ast.dart
- // TypeParameterList is from package:analyzer/dart/ast/ast.dart
- //
- // package:analyzer/src/fasta/ast_builder.dart 1618:40 AstBuilder.endMethod
- // test/generated/parser_fasta_listener.dart 926:14 ForwardingTestListener.endMethod
- // package:front_end/src/fasta/parser/parser.dart 2433:14 Parser.parseMethod
- // package:front_end/src/fasta/parser/parser.dart 2323:11 Parser.parseMember
- // test/generated/parser_fasta_test.dart 3438:39 ParserProxy._run
- super.test_method_invalidTypeParameterExtends();
+ // Ignored: Fasta does not support the generic comment syntax.
}
@override
@@ -535,22 +472,6 @@
@override
@failingTest
- void test_method_invalidTypeParameters() {
- // TODO(brianwilkerson) Does not recover.
- // type 'DeclaredSimpleIdentifier' is not a subtype of type 'TypeAnnotation' of 'returnType' where
- // DeclaredSimpleIdentifier is from package:analyzer/src/dart/ast/ast.dart
- // TypeAnnotation is from package:analyzer/dart/ast/ast.dart
- //
- // package:analyzer/src/fasta/ast_builder.dart 1620:33 AstBuilder.endMethod
- // test/generated/parser_fasta_listener.dart 926:14 ForwardingTestListener.endMethod
- // package:front_end/src/fasta/parser/parser.dart 2433:14 Parser.parseMethod
- // package:front_end/src/fasta/parser/parser.dart 2323:11 Parser.parseMember
- // test/generated/parser_fasta_test.dart 3438:39 ParserProxy._run
- super.test_method_invalidTypeParameters();
- }
-
- @override
- @failingTest
void test_missingAssignableSelector_identifiersAssigned() {
// TODO(brianwilkerson) Does not recover.
// Expected: true
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 1154211..fb9fe1c 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -3677,29 +3677,45 @@
}
void test_getterInFunction_block_noReturnType() {
- FunctionDeclarationStatement statement =
- parseStatement("get x { return _x; }");
- listener.assertErrors(
- [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 0, 3)]);
- expect(statement.functionDeclaration.functionExpression.parameters, isNull);
+ Statement result =
+ parseStatement("get x { return _x; }", expectedEndOffset: 4);
+ if (usingFastaParser) {
+ // Fasta considers `get` to be an identifier in this situation.
+ ExpressionStatement statement = result;
+ listener
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 1)]);
+ expect(statement.expression.toSource(), 'get');
+ } else {
+ FunctionDeclarationStatement statement = result;
+ listener.assertErrors(
+ [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 0, 3)]);
+ expect(
+ statement.functionDeclaration.functionExpression.parameters, isNull);
+ }
}
void test_getterInFunction_block_returnType() {
- parseStatement("int get x { return _x; }");
- listener.assertErrors(
- [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 4, 3)]);
+ // Fasta considers `get` to be an identifier in this situation.
+ parseStatement("int get x { return _x; }", expectedEndOffset: 8);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)]
+ : [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 4, 3)]);
}
void test_getterInFunction_expression_noReturnType() {
- parseStatement("get x => _x;");
- listener.assertErrors(
- [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 0, 3)]);
+ // Fasta considers `get` to be an identifier in this situation.
+ parseStatement("get x => _x;", expectedEndOffset: 4);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 1)]
+ : [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 0, 3)]);
}
void test_getterInFunction_expression_returnType() {
- parseStatement("int get x => _x;");
- listener.assertErrors(
- [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 4, 3)]);
+ // Fasta considers `get` to be an identifier in this situation.
+ parseStatement("int get x => _x;", expectedEndOffset: 8);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)]
+ : [expectedError(ParserErrorCode.GETTER_IN_FUNCTION, 4, 3)]);
}
void test_getterWithParameters() {
@@ -4194,16 +4210,19 @@
createParser('f<E>(E extends num p);');
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
- listener.assertErrors([
- expectedError(
- ParserErrorCode.MISSING_IDENTIFIER, 0, 0), // `extends` is a keyword
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0), // comma
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0), // close paren
- expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 0, 0)
- ]);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 7)]
+ : [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 0,
+ 0), // `extends` is a keyword
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0), // comma
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0), // close paren
+ expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 0, 0)
+ ]);
expect(member, new isInstanceOf<MethodDeclaration>());
MethodDeclaration method = member;
- expect(method.parameters.toString(), '(E, extends)',
+ expect(
+ method.parameters.toString(), usingFastaParser ? '(E)' : '(E, extends)',
reason: 'parser recovers what it can');
}
@@ -4254,13 +4273,17 @@
createParser('void m<E, hello!>() {}');
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
- listener.assertErrors([
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0) /*>*/,
- expectedError(ParserErrorCode.MISSING_IDENTIFIER, 0, 0),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0) /*(*/,
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0) /*)*/,
- expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 0, 0)
- ]);
+ listener.assertErrors(usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 15, 1) /*>*/
+ ]
+ : [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0) /*>*/,
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 0, 0),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0) /*(*/,
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 0, 0) /*)*/,
+ expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 0, 0)
+ ]);
expect(member, new isInstanceOf<MethodDeclaration>());
MethodDeclaration method = member;
expect(method.typeParameters.toString(), '<E, hello>',
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 6d12d04..32df76a 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -6725,6 +6725,26 @@
expect(x.constantValue.toIntValue(), 1);
}
+ test_currentSession() async {
+ var a = _p('/a.dart');
+
+ provider.newFile(a, 'var V = 1;');
+ await driver.getResult(a);
+
+ var session1 = driver.currentSession;
+ expect(session1, isNotNull);
+
+ provider.updateFile(a, 'var V = 2;');
+ driver.changeFile(a);
+ await driver.getResult(a);
+
+ var session2 = driver.currentSession;
+ expect(session2, isNotNull);
+
+ // We get a new session.
+ expect(session2, isNot(session1));
+ }
+
test_errors_uriDoesNotExist_export() async {
addTestFile(r'''
export 'foo.dart';
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index 3a51631..78f7a70 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -960,9 +960,11 @@
@failingTest
test_useCFE() async {
- await drive('data/options_tests_project/test_file.dart',
- args: ['--use-cfe']);
- expect(driver.context.analysisOptions.useFastaParser, isTrue);
+ // Disabled until integration with the CFE has been restarted.
+ fail('Times out when run on a VM with --preview-dart-2 enabled');
+// await drive('data/options_tests_project/test_file.dart',
+// args: ['--use-cfe']);
+// expect(driver.context.analysisOptions.useFastaParser, isTrue);
}
test_withFlags_overrideFatalWarning() async {
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 8ede4a9..2840816 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -2767,10 +2767,19 @@
listener.beginTypeVariables(begin);
int count = 0;
do {
- token = parseTypeVariable(token.next);
+ token = parseTypeVariable(next);
+ next = token.next;
++count;
- } while (optional(',', token.next));
- token = begin.endToken = ensureGt(token);
+ } while (optional(',', next));
+ if (next == begin.endToken) {
+ token = next;
+ } else if (begin.endToken != null) {
+ reportRecoverableError(
+ next, fasta.templateExpectedToken.withArguments('>'));
+ token = begin.endToken;
+ } else {
+ token = begin.endToken = ensureGt(token);
+ }
listener.endTypeVariables(count, begin, token);
} else {
listener.handleNoTypeVariables(next);
@@ -5491,14 +5500,18 @@
typeInfo.couldBeExpression) {
// Detect expressions such as identifier `as` identifier
// and treat those as expressions.
- int kind = next.next.kind;
- if (EQ_TOKEN != kind && SEMICOLON_TOKEN != kind && COMMA_TOKEN != kind) {
- if (onlyParseVariableDeclarationStart) {
- if (!optional('in', next.next)) {
- return start;
+ if (optional('as', next) || optional('is', next)) {
+ int kind = next.next.kind;
+ if (EQ_TOKEN != kind &&
+ SEMICOLON_TOKEN != kind &&
+ COMMA_TOKEN != kind) {
+ if (onlyParseVariableDeclarationStart) {
+ if (!optional('in', next.next)) {
+ return start;
+ }
+ } else {
+ return parseExpressionStatement(start);
}
- } else {
- return parseExpressionStatement(start);
}
}
}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 0d9f1cd..0521a33 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -183,7 +183,7 @@
cc/Debugger_PrintBreakpointsToJSONArray: Fail
cc/Debugger_Rewind_Optimized: SkipSlow
cc/Debugger_SetBreakpointInPartOfLibrary: Crash
-cc/FunctionSourceFingerprint: Fail
+cc/FunctionSourceFingerprint: Fail # Issue 30756
cc/GenerateSource: Skip # Cannot generate source from a kernel binary.
cc/IsolateReload_NotTypedefToTypedef: Fail
cc/IsolateReload_TypedefToNotTypedef: Fail
@@ -266,7 +266,6 @@
cc/IsolateReload_LibraryImportAdded: Crash # Issue 32190
cc/IsolateReload_LibraryImportRemoved: Fail # Issue 32190
cc/IsolateReload_LibraryLookup: Fail, Crash # Issue 32190
-cc/Mixin_PrivateSuperResolutionCrossLibraryShouldFail: Fail, Crash # Issue 32190
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
diff --git a/runtime/vm/mixin_test.cc b/runtime/vm/mixin_test.cc
index fc73af3..04556da 100644
--- a/runtime/vm/mixin_test.cc
+++ b/runtime/vm/mixin_test.cc
@@ -84,18 +84,23 @@
}};
// clang-format on
+ Isolate* isolate = Isolate::Current();
Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
/* resolver= */ NULL, /* finalize= */ true, /* incrementally= */ true);
- EXPECT_VALID(lib);
- Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
- const char* result_str = NULL;
- EXPECT(Dart_IsString(result));
- EXPECT_VALID(Dart_StringToCString(result, &result_str));
- EXPECT_STREQ(
- "NoSuchMethodError: Super class of class 'D' has no instance method "
- "'_bar'.",
- result_str);
+ if (isolate->strong()) {
+ EXPECT_ERROR(lib, "Error: Superclass has no method named '_bar'.");
+ } else {
+ EXPECT_VALID(lib);
+ Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
+ const char* result_str = NULL;
+ EXPECT(Dart_IsString(result));
+ EXPECT_VALID(Dart_StringToCString(result, &result_str));
+ EXPECT_STREQ(
+ "NoSuchMethodError: Super class of class 'D' has no instance method "
+ "'_bar'.",
+ result_str);
+ }
}
#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/tools/VERSION b/tools/VERSION
index 2e2e188..0827ae8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 41
+PRERELEASE 42
PRERELEASE_PATCH 0