| Index: test/baseline_strong_mode_test.dart
|
| diff --git a/test/baseline_strong_mode_test.dart b/test/baseline_strong_mode_test.dart
|
| index fa8626911fe3713fab29ee970c4d8bfe1c6ce8ac..51d2a7c032e49f1b35cb1548a97e34d8ad16328f 100644
|
| --- a/test/baseline_strong_mode_test.dart
|
| +++ b/test/baseline_strong_mode_test.dart
|
| @@ -1,8 +1,12 @@
|
| // Copyright (c) 2016, 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 'package:kernel/class_hierarchy.dart';
|
| +import 'package:kernel/core_types.dart';
|
| import 'package:kernel/kernel.dart';
|
| import 'package:kernel/transformations/mixin_full_resolution.dart';
|
| +import 'package:kernel/type_checker.dart';
|
| +import 'package:path/path.dart' as pathlib;
|
|
|
| import 'baseline_tester.dart';
|
|
|
| @@ -17,8 +21,40 @@ class StrongModeTest extends TestTarget {
|
| bool get strongMode => true;
|
|
|
| @override
|
| - void transformProgram(Program program) {
|
| + List<String> transformProgram(Program program) {
|
| + List<String> errors = <String>[];
|
| new MixinFullResolution().transform(program);
|
| + new TestTypeChecker(
|
| + errors, new CoreTypes(program), new ClassHierarchy(program))
|
| + .checkProgram(program);
|
| + return errors;
|
| + }
|
| +}
|
| +
|
| +class TestTypeChecker extends TypeChecker {
|
| + final List<String> errors;
|
| +
|
| + TestTypeChecker(this.errors, CoreTypes coreTypes, ClassHierarchy hierarchy)
|
| + : super(coreTypes, hierarchy);
|
| +
|
| + @override
|
| + void checkAssignable(TreeNode where, DartType from, DartType to) {
|
| + if (!environment.isSubtypeOf(from, to)) {
|
| + fail(where, '$from is not a subtype of $to');
|
| + }
|
| + }
|
| +
|
| + @override
|
| + void fail(TreeNode where, String message) {
|
| + var location = where.location;
|
| + var locationString;
|
| + if (location != null) {
|
| + var file = pathlib.basename(Uri.parse(location.file).path);
|
| + locationString = '($file:${location.line}:${location.column})';
|
| + } else {
|
| + locationString = '(no location)';
|
| + }
|
| + errors.add('$message $locationString');
|
| }
|
| }
|
|
|
|
|