dart-sdk/tests/language/regress/regress43366_test.dart
Stephen Adams 8d68480746 [dart2js] Fix global type analysis
https://github.com/dart-lang/sdk/issues/43366

Fixed: 43366
Change-Id: Iac8247c31fa268186c8f2e3f52e0be1cac062598
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162247
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-09-11 04:07:41 +00:00

28 lines
632 B
Dart

// Copyright (c) 2020, 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.
String upcase(String? s) {
if (s == null) return '';
return s.toUpperCase();
}
String format(dynamic thing) {
if (thing is String?) return upcase(thing);
if (thing is num) return '$thing';
return '?';
}
main() {
log(format(null));
log(format('hello'));
log(format([]));
if (trace != '[][HELLO][?]') throw 'Unexpected: "$trace"';
}
String trace = '';
void log(String s) {
trace += '[$s]';
}