blob: 3185f058eba7d337f2b75b28eb31d7896832ff3a [file] [log] [blame]
// Copyright (c) 2013, 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 'native_testing.dart';
import 'dart:_js_helper' show intTypeCheck;
bool get inComplianceMode {
try {
String a = (42 as dynamic);
} on TypeError catch (e) {
return true;
return false;
main() {
var a = [];
// By calling directly [intTypeCheck] with an int, we're making the
// type inferrer infer that the parameter type of [intTypeCheck] is
// always an int, and therefore the method will be compiled to
// never throw. So when the backend actually uses the helper for
// implementing checked mode semantics (like in the check below),
// the check won't fail at runtime.
if (inComplianceMode) {
int value;
Expect.throws(() => value = a[1], (e) => e is TypeError);