dart-sdk/tests/language_2/closure_param_null_to_object_test.dart
Paul Berry 12dc862d9e When type inferring closures, change Null arguments to Object.
Fixes #31546.

Change-Id: I1c69947f4589b6901ac11b2e6c9f6c3624678ad4
Reviewed-on: https://dart-review.googlesource.com/27411
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-12-08 00:05:39 +00:00

17 lines
679 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 "package:expect/expect.dart";
main() {
int Function(Null) f = (x) => 1; // Runtime type is int Function(Object)
Expect.isTrue(f is int Function(Null));
Expect.isTrue(f is int Function(String));
Expect.isTrue(f is int Function(Object));
int Function(String) g = (x) => 1; // Runtime type is int Function(String)
Expect.isTrue(g is int Function(Null));
Expect.isTrue(g is int Function(String));
Expect.isFalse(g is int Function(Object));
}