mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 22:21:18 +00:00
a18b318fed
style instead of 'return' keyword (fixes #30339). Add regression test. R=asiva@google.com, cbernaschina@google.com Review-Url: https://codereview.chromium.org/2993223002 .
38 lines
769 B
Dart
38 lines
769 B
Dart
// Copyright (c) 2017, 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:async';
|
|
import 'package:expect/expect.dart';
|
|
|
|
isCheckedMode() {
|
|
try {
|
|
var i = 1;
|
|
String s = i;
|
|
return false;
|
|
} on TypeError {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
var x = 'a';
|
|
|
|
Future<int> foo() async {
|
|
return x;
|
|
}
|
|
|
|
Future<int> bar() async => x;
|
|
|
|
main() {
|
|
foo().then((_) {
|
|
Expect.isFalse(isCheckedMode());
|
|
}, onError: (e) {
|
|
Expect.isTrue(isCheckedMode() && (e is TypeError));
|
|
});
|
|
bar().then((_) {
|
|
Expect.isFalse(isCheckedMode());
|
|
}, onError: (e) {
|
|
Expect.isTrue(isCheckedMode() && (e is TypeError));
|
|
});
|
|
}
|