mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:28:02 +00:00
Demonstrate bug for the VMs way of doing initializers in face of mixins
See http://dartbug.com/34841#issuecomment-458917175 and test in this CL for explanation. Change-Id: Ie1d15078a9c5f71aa6edacd792b440520a3eb877 Reviewed-on: https://dart-review.googlesource.com/c/91660 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com>
This commit is contained in:
parent
d6608f19c0
commit
c3c525079b
3 changed files with 78 additions and 0 deletions
9
runtime/observatory/tests/service/regress_34841_lib.dart
Normal file
9
runtime/observatory/tests/service/regress_34841_lib.dart
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) 2019, 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.
|
||||
|
||||
class Foo {
|
||||
final String foo = () {
|
||||
return StackTrace.current.toString();
|
||||
}();
|
||||
}
|
68
runtime/observatory/tests/service/regress_34841_test.dart
Normal file
68
runtime/observatory/tests/service/regress_34841_test.dart
Normal file
|
@ -0,0 +1,68 @@
|
|||
// Copyright (c) 2019, 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.
|
||||
|
||||
// While it's not (currently) necessary, add some noise here to push down token
|
||||
// positions in this file compared to the file regress_34841_lib.dart.
|
||||
// This is to ensure that any possible tokens in that file are just comments
|
||||
// (i.e. not actual) positions in this file.
|
||||
|
||||
import 'package:observatory/service_io.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
import 'test_helper.dart';
|
||||
import 'service_test_common.dart';
|
||||
import 'dart:developer';
|
||||
import 'regress_34841_lib.dart';
|
||||
|
||||
class Bar extends Object with Foo {}
|
||||
|
||||
void testFunction() {
|
||||
Bar bar = new Bar();
|
||||
print(bar.foo);
|
||||
debugger();
|
||||
}
|
||||
|
||||
var tests = <IsolateTest>[
|
||||
hasStoppedAtBreakpoint,
|
||||
(Isolate isolate) async {
|
||||
var stack = await isolate.getStack();
|
||||
|
||||
// Make sure we are in the right place.
|
||||
expect(stack.type, equals('Stack'));
|
||||
expect(stack['frames'].length, greaterThanOrEqualTo(1));
|
||||
expect(stack['frames'][0].function.name, equals('testFunction'));
|
||||
|
||||
var root = isolate.rootLibrary;
|
||||
await root.load();
|
||||
Script script = root.scripts.first;
|
||||
await script.load();
|
||||
|
||||
var params = {
|
||||
'reports': ['Coverage'],
|
||||
'scriptId': script.id,
|
||||
'forceCompile': true
|
||||
};
|
||||
var report = await isolate.invokeRpcNoUpgrade('getSourceReport', params);
|
||||
List<dynamic> ranges = report['ranges'];
|
||||
List<int> coveragePlaces = <int>[];
|
||||
for (var range in ranges) {
|
||||
for (int i in range["coverage"]["hits"]) {
|
||||
coveragePlaces.add(i);
|
||||
}
|
||||
for (int i in range["coverage"]["misses"]) {
|
||||
coveragePlaces.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we can translate it all.
|
||||
for (int place in coveragePlaces) {
|
||||
int line = script.tokenToLine(place);
|
||||
int column = script.tokenToCol(place);
|
||||
if (line == null || column == null) {
|
||||
throw "Token $place translated to $line:$column";
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction);
|
|
@ -46,6 +46,7 @@ evaluate_activation_in_method_class_test: RuntimeError # Issue 35505
|
|||
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
|
||||
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
|
||||
pause_on_unhandled_async_exceptions2_test: Pass, Slow
|
||||
regress_34841_test: RuntimeError # http://dartbug.com/34841
|
||||
unused_changes_in_last_reload_test: RuntimeError
|
||||
|
||||
[ $compiler == dartkp ]
|
||||
|
|
Loading…
Reference in a new issue