Version 2.14.0-227.0.dev
Merge commit 'bcf6350b151d2c2ea1aa559e4b696e2ea8976860' into 'dev'
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index a7a7b27..a19caf2 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -507,7 +507,9 @@
int toInt();
}
-abstract class Match {}
+abstract class Match {
+ int get start;
+}
class Object {
const Object();
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index cd978d6..c5e44a7 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -3,6 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/diagnostic/diagnostic.dart';
+import 'package:analyzer/error/error.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:nnbd_migration/nnbd_migration.dart';
import 'package:test/test.dart';
@@ -50,7 +52,8 @@
Map<String, String> input, Map<String, String> expectedOutput,
{Map<String, String> migratedInput = const {},
bool removeViaComments = false,
- bool warnOnWeakCode = false}) async {
+ bool warnOnWeakCode = false,
+ bool allowErrors = false}) async {
for (var path in migratedInput.keys) {
newFile(path, content: migratedInput[path]);
}
@@ -66,6 +69,11 @@
var resolvedLibrary = await session.getResolvedLibrary2(path);
if (resolvedLibrary is ResolvedLibraryResult) {
for (var unit in resolvedLibrary.units) {
+ var errors =
+ unit.errors.where((e) => e.severity == Severity.error).toList();
+ if (!allowErrors && errors.isNotEmpty) {
+ fail('Unexpected error(s): $errors');
+ }
migration.prepareInput(unit);
}
}
@@ -112,13 +120,15 @@
Future<void> _checkSingleFileChanges(String content, String expected,
{Map<String, String> migratedInput = const {},
bool removeViaComments = false,
- bool warnOnWeakCode = false}) async {
+ bool warnOnWeakCode = false,
+ bool allowErrors = false}) async {
var sourcePath = convertPath('$testsPath/lib/test.dart');
await _checkMultipleFileChanges(
{sourcePath: content}, {sourcePath: expected},
migratedInput: migratedInput,
removeViaComments: removeViaComments,
- warnOnWeakCode: warnOnWeakCode);
+ warnOnWeakCode: warnOnWeakCode,
+ allowErrors: allowErrors);
}
}
@@ -516,6 +526,7 @@
final C c;
B(this.c);
B<T> cast<T>() => c._castFrom<E, T>(this);
+ noSuchMethod(invocation) => super.noSuchMethod(invocation);
}
abstract class C {
B<T> _castFrom<S, T>(B<S> source);
@@ -526,6 +537,7 @@
final C c;
B(this.c);
B<T> cast<T>() => c._castFrom<E, T>(this);
+ noSuchMethod(invocation) => super.noSuchMethod(invocation);
}
abstract class C {
B<T> _castFrom<S, T>(B<S> source);
@@ -609,7 +621,9 @@
f(null, null);
}
''';
- await _checkSingleFileChanges(content, expected);
+ // Note: using allowErrors=true because variables introduced by a catch
+ // clause are final
+ await _checkSingleFileChanges(content, expected, allowErrors: true);
}
Future<void> test_catch_with_on() async {
@@ -649,7 +663,9 @@
f(null, null);
}
''';
- await _checkSingleFileChanges(content, expected);
+ // Note: using allowErrors=true because variables introduced by a catch
+ // clause are final
+ await _checkSingleFileChanges(content, expected, allowErrors: true);
}
Future<void> test_class_alias_synthetic_constructor_with_parameters() async {
@@ -1947,7 +1963,9 @@
x[0] = 1 as Null;
}
''';
- await _checkSingleFileChanges(content, expected);
+ // Note: using allowErrors=true because casting a literal int to a Null is
+ // an error
+ await _checkSingleFileChanges(content, expected, allowErrors: true);
}
Future<void> test_downcast_type_argument_preserve_nullability() async {
@@ -2112,7 +2130,7 @@
var content = '''
enum E {
value
-};
+}
E f() => E.value;
int g() => f().index;
@@ -2131,7 +2149,7 @@
var expected = '''
enum E {
value
-};
+}
E f() => E.value;
int g() => f().index;
@@ -2979,7 +2997,8 @@
}
g(String s) {}
''';
- await _checkSingleFileChanges(content, expected);
+ // Note: using allowErrors=true because an uninitialized field is an error
+ await _checkSingleFileChanges(content, expected, allowErrors: true);
}
Future<void> test_field_formal_param_typed() async {
@@ -3159,9 +3178,9 @@
class C {
int i;
C() : i = 0;
- factory C.factoryConstructor => C();
- factory C.factoryRedirect = D;
- C.redirect : this();
+ factory C.factoryConstructor() => C();
+ factory C.factoryRedirect() = D;
+ C.redirect() : this();
}
class D extends C {}
''';
@@ -3169,9 +3188,9 @@
class C {
int i;
C() : i = 0;
- factory C.factoryConstructor => C();
- factory C.factoryRedirect = D;
- C.redirect : this();
+ factory C.factoryConstructor() => C();
+ factory C.factoryRedirect() = D;
+ C.redirect() : this();
}
class D extends C {}
''';
@@ -3666,7 +3685,7 @@
void test({String foo}) async {
var f = () {
return "hello";
- }
+ };
foo.length;
}
@@ -3675,7 +3694,7 @@
void test({required String foo}) async {
var f = () {
return "hello";
- }
+ };
foo.length;
}
@@ -6969,7 +6988,7 @@
}
void main() {
- C<int/*!*/>().m(null!);
+ C<int/*!*/>().m(null/*!*/);
}
''';
var expected = '''
@@ -7312,10 +7331,10 @@
setUp(() {
i = 1;
});
+ f(int /*?*/ i) {}
test('a', () {
f(i);
});
- f(int /*?*/ i) {}
}
''';
var expected = '''
@@ -7325,10 +7344,10 @@
setUp(() {
i = 1;
});
+ f(int? i) {}
test('a', () {
f(i);
});
- f(int? i) {}
}
''';
await _checkSingleFileChanges(content, expected);
@@ -7464,10 +7483,10 @@
// The inference of C<int?> forces class C to be declared as
// C<T extends Object?>.
var content = '''
-class C<T extends Object> {
+abstract class C<T extends Object> {
void m(T t);
}
-class D<T extends Object> {
+abstract class D<T extends Object> {
void m(T t);
}
f(C<int> c, D<int> d) {
@@ -7475,10 +7494,10 @@
}
''';
var expected = '''
-class C<T extends Object?> {
+abstract class C<T extends Object?> {
void m(T t);
}
-class D<T extends Object> {
+abstract class D<T extends Object> {
void m(T t);
}
f(C<int?> c, D<int> d) {
diff --git a/pkg/vm_service/test/async_generator_breakpoint_test.dart b/pkg/vm_service/test/async_generator_breakpoint_test.dart
index fb999fc..af9cc5c 100644
--- a/pkg/vm_service/test/async_generator_breakpoint_test.dart
+++ b/pkg/vm_service/test/async_generator_breakpoint_test.dart
@@ -55,23 +55,18 @@
final bp1 = await service.addBreakpoint(isolateId, scriptId, 11);
expect(bp1, isNotNull);
- expect(bp1 is Breakpoint, isTrue);
final bp2 = await service.addBreakpoint(isolateId, scriptId, 16);
expect(bp2, isNotNull);
- expect(bp2 is Breakpoint, isTrue);
final bp3 = await service.addBreakpoint(isolateId, scriptId, 21);
expect(bp3, isNotNull);
- expect(bp3 is Breakpoint, isTrue);
final bp4 = await service.addBreakpoint(isolateId, scriptId, 25);
expect(bp4, isNotNull);
- expect(bp4 is Breakpoint, isTrue);
final bp5 = await service.addBreakpoint(isolateId, scriptId, 42);
expect(bp5, isNotNull);
- expect(bp5 is Breakpoint, isTrue);
final hits = <Breakpoint>[];
await service.streamListen(EventStreams.kDebug);
diff --git a/tools/VERSION b/tools/VERSION
index e803b1c..6b36631 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 226
+PRERELEASE 227
PRERELEASE_PATCH 0
\ No newline at end of file