Version 2.13.0-177.0.dev
Merge commit '38d5c5e444cf53567356df1bfc8a117130c7a52e' into 'dev'
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index bd826d4..f22e8c1 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -853,10 +853,10 @@
element.enclosingElement.name == 'Packed';
}
- int get packedMemberAlignment {
+ int? get packedMemberAlignment {
assert(isPacked);
final value = computeConstantValue();
- return value!.getField('memberAlignment')!.toIntValue()!;
+ return value?.getField('memberAlignment')?.toIntValue();
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart b/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart
index 5ebf701..21a5454 100644
--- a/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/packed_annotation_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/dart/error/ffi_code.dart';
+import 'package:analyzer/src/error/codes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/context_collection_resolution.dart';
@@ -15,7 +16,7 @@
@reflectiveTest
class PackedAnnotation extends PubPackageResolutionTest {
- test_error() async {
+ test_error_1() async {
await assertErrorsInCode(r'''
import 'dart:ffi';
@@ -29,6 +30,21 @@
]);
}
+ /// Regress test for http://dartbug.com/45498.
+ test_error_2() async {
+ await assertErrorsInCode(r'''
+import 'dart:ffi';
+
+@Packed()
+class C extends Struct {
+ external Pointer<Uint8> notEmpty;
+}
+''', [
+ error(FfiCode.PACKED_ANNOTATION_ALIGNMENT, 20, 9),
+ error(CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS, 27, 2),
+ ]);
+ }
+
test_no_error_1() async {
await assertNoErrorsInCode(r'''
import 'dart:ffi';
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index 8608b32..3ddf48d 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -39,6 +39,7 @@
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
get_source_report_test: RuntimeError # Should pass again when constant evaluation is relanded, see http://dartbug.com/36600
+pause_on_exception_from_slow_path_test: Pass, Slow
pause_on_unhandled_async_exceptions2_test: Pass, Slow
[ $compiler == dartkp ]
diff --git a/runtime/observatory_2/tests/service_2/service_2_kernel.status b/runtime/observatory_2/tests/service_2/service_2_kernel.status
index 227cb0a..099e686 100644
--- a/runtime/observatory_2/tests/service_2/service_2_kernel.status
+++ b/runtime/observatory_2/tests/service_2/service_2_kernel.status
@@ -39,6 +39,7 @@
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
get_source_report_test: RuntimeError # Should pass again when constant evaluation is relanded, see http://dartbug.com/36600
+pause_on_exception_from_slow_path_test: Pass, Slow
pause_on_unhandled_async_exceptions2_test: Pass, Slow
[ $compiler == dartkp ]
diff --git a/runtime/tools/dartfuzz/dartfuzz_test.dart b/runtime/tools/dartfuzz/dartfuzz_test.dart
index 8e826fa..612c1aa 100644
--- a/runtime/tools/dartfuzz/dartfuzz_test.dart
+++ b/runtime/tools/dartfuzz/dartfuzz_test.dart
@@ -116,12 +116,16 @@
static String getTag(String mode) {
if (mode.endsWith('debug-ia32')) return 'DebugIA32';
if (mode.endsWith('debug-x64')) return 'DebugX64';
+ if (mode.endsWith('debug-x64c')) return 'DebugX64C';
if (mode.endsWith('debug-arm32')) return 'DebugSIMARM';
if (mode.endsWith('debug-arm64')) return 'DebugSIMARM64';
+ if (mode.endsWith('debug-arm64c')) return 'DebugSIMARM64C';
if (mode.endsWith('ia32')) return 'ReleaseIA32';
if (mode.endsWith('x64')) return 'ReleaseX64';
+ if (mode.endsWith('x64c')) return 'ReleaseX64C';
if (mode.endsWith('arm32')) return 'ReleaseSIMARM';
if (mode.endsWith('arm64')) return 'ReleaseSIMARM64';
+ if (mode.endsWith('arm64c')) return 'ReleaseSIMARM64C';
throw ('unknown tag in mode: $mode');
}
@@ -674,14 +678,20 @@
static const List<String> clusterModes = [
'jit-debug-ia32',
'jit-debug-x64',
+ 'jit-debug-x64c',
'jit-debug-arm32',
'jit-debug-arm64',
+ 'jit-debug-arm64c',
'jit-ia32',
'jit-x64',
+ 'jit-x64c',
'jit-arm32',
'jit-arm64',
+ 'jit-arm64c',
'aot-debug-x64',
+ 'aot-debug-x64c',
'aot-x64',
+ 'aot-x64c',
];
// Modes not used on cluster runs because they have outstanding issues.
@@ -689,8 +699,10 @@
// Times out often:
'aot-debug-arm32',
'aot-debug-arm64',
+ 'aot-debug-arm64c',
'aot-arm32',
'aot-arm64',
+ 'aot-arm64c',
// Too many divergences (due to arithmetic):
'js-x64',
];
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 05a38c9..e82c80d 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -8554,7 +8554,8 @@
}
bool FunctionType::HasSameTypeParametersAndBounds(const FunctionType& other,
- TypeEquality kind) const {
+ TypeEquality kind,
+ TrailPtr trail) const {
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
@@ -8574,7 +8575,7 @@
for (intptr_t i = 0; i < num_type_params; i++) {
type_param ^= type_params.TypeAt(i);
other_type_param ^= other_type_params.TypeAt(i);
- if (!type_param.IsEquivalent(other_type_param, kind)) {
+ if (!type_param.IsEquivalent(other_type_param, kind, trail)) {
return false;
}
}
@@ -20286,7 +20287,7 @@
// Compare function type parameters and their bounds.
// Check the type parameters and bounds of generic functions.
- if (!HasSameTypeParametersAndBounds(other_type, kind)) {
+ if (!HasSameTypeParametersAndBounds(other_type, kind, trail)) {
return false;
}
AbstractType& param_type = Type::Handle(zone);
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 5a0d154..6a4b5bb 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -8224,7 +8224,8 @@
// with equal bounds as the other function type. Type parameter names and
// parameter names (unless optional named) are ignored.
bool HasSameTypeParametersAndBounds(const FunctionType& other,
- TypeEquality kind) const;
+ TypeEquality kind,
+ TrailPtr trail = nullptr) const;
// Return true if this function type declares type parameters.
bool IsGeneric() const { return NumTypeParameters(Thread::Current()) > 0; }
diff --git a/sdk/lib/_internal/vm/lib/ffi_patch.dart b/sdk/lib/_internal/vm/lib/ffi_patch.dart
index 75a6e51..d2b0d0a 100644
--- a/sdk/lib/_internal/vm/lib/ffi_patch.dart
+++ b/sdk/lib/_internal/vm/lib/ffi_patch.dart
@@ -129,7 +129,7 @@
_checkIndex(int index) {
if (index < 0 || index >= _size) {
- throw RangeError.range(index, 0, _size);
+ throw RangeError.range(index, 0, _size - 1);
}
}
diff --git a/tests/ffi/regress_45189_test.dart b/tests/ffi/regress_45189_test.dart
new file mode 100644
index 0000000..980d1bc
--- /dev/null
+++ b/tests/ffi/regress_45189_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2021, 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.
+
+import "dart:ffi";
+
+import "package:ffi/ffi.dart";
+import 'package:expect/expect.dart';
+
+class Struct8BytesInlineArrayInt extends Struct {
+ @Array(8)
+ external Array<Uint8> a0;
+}
+
+void main() {
+ final pointer = calloc<Struct8BytesInlineArrayInt>();
+ final array = pointer.ref.a0;
+ try {
+ array[8]; // RangeError: Invalid value: Not in inclusive range 0..8: 8
+ } on RangeError catch (exception) {
+ final toString = exception.toString();
+ Expect.equals(
+ "RangeError: Invalid value: Not in inclusive range 0..7: 8", toString);
+ }
+ calloc.free(pointer);
+}
diff --git a/tests/ffi_2/regress_45189_test.dart b/tests/ffi_2/regress_45189_test.dart
new file mode 100644
index 0000000..1aff90b
--- /dev/null
+++ b/tests/ffi_2/regress_45189_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2021, 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.
+
+import "dart:ffi";
+
+import "package:ffi/ffi.dart";
+import 'package:expect/expect.dart';
+
+class Struct8BytesInlineArrayInt extends Struct {
+ @Array(8)
+ Array<Uint8> a0;
+}
+
+void main() {
+ final pointer = calloc<Struct8BytesInlineArrayInt>();
+ final array = pointer.ref.a0;
+ try {
+ array[8]; // RangeError: Invalid value: Not in inclusive range 0..8: 8
+ } on RangeError catch (exception) {
+ final toString = exception.toString();
+ Expect.equals(
+ "RangeError: Invalid value: Not in inclusive range 0..7: 8", toString);
+ }
+ calloc.free(pointer);
+}
diff --git a/tests/language/regress/regress45443_test.dart b/tests/language/regress/regress45443_test.dart
new file mode 100644
index 0000000..a979342
--- /dev/null
+++ b/tests/language/regress/regress45443_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2021, 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.
+
+// SharedOptions=--enable-experiment=generic-metadata
+
+class C1<T extends void Function<TT extends T>()> {}
+
+class C2<T extends TT Function<TT extends T>()> {}
+
+main() {
+ print("OK");
+}
diff --git a/tools/VERSION b/tools/VERSION
index 039ac60..39fe5a8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 13
PATCH 0
-PRERELEASE 176
+PRERELEASE 177
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 3244485..7067b9a 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -244,12 +244,15 @@
"out/DebugIA32/",
"out/DebugSIMARM/",
"out/DebugSIMARM64/",
+ "out/DebugSIMARM64C/",
"out/DebugX64/",
- "out/ProductX64/",
+ "out/DebugX64C/",
"out/ReleaseIA32/",
"out/ReleaseSIMARM/",
"out/ReleaseSIMARM64/",
+ "out/ReleaseSIMARM64C/",
"out/ReleaseX64/",
+ "out/ReleaseX64C/",
"third_party/pkg/",
"third_party/pkg_tested/",
"tools/sdks/dart-sdk/",
@@ -3666,7 +3669,7 @@
"script": "tools/build.py",
"arguments": [
"--mode=debug,release",
- "--arch=x64,simarm64",
+ "--arch=x64,x64c,simarm64,simarm64c",
"runtime",
"dart_precompiled_runtime"
]