Files
sdk/pkg/vm_service/test/regress_48279_test.dart
Ben Konyi 39e60fa3fc [ package:vm_service ] Enable more lints
Change-Id: I1a7548297fa8562ea81f3d4e32db2aba53661189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335960
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-11-14 21:26:31 +00:00

46 lines
1.4 KiB
Dart

// Copyright (c) 2022, 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.
// This test verifies that generic type argument ('T') can be evaluated
// when stopped on an exception which is thrown during type check in
// the implicit field setter.
// Regression test for https://github.com/dart-lang/sdk/issues/48279.
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'common/service_test_common.dart';
import 'common/test_helper.dart';
class A<T, U, V> {
List<T> foo = [];
}
void testeeMain() {
final A<num, Object, Object> object = A<int, String, String>();
object.foo = <double>[];
}
final tests = <IsolateTest>[
hasStoppedWithUnhandledException,
(VmService service, IsolateRef isolateRef) async {
print('We stopped!');
final isolateId = isolateRef.id!;
final stack = await service.getStack(isolateId);
final topFrame = stack.frames![0];
expect(topFrame.function!.name, equals('foo='));
final result = await service.evaluateInFrame(isolateId, 0, 'T');
print(result);
expect((result as InstanceRef).name, equals('int'));
}
];
Future<void> main(args) => runIsolateTests(
args,
tests,
'regress_48279_test.dart',
pauseOnUnhandledExceptions: true,
testeeConcurrent: testeeMain,
);