From 8171191413ab292dcc66b9e4106c4231744ada39 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Thu, 6 Jul 2023 20:18:24 +0000 Subject: [PATCH] [dart2js] Add regression test for #52825 I still haven't found yet the fix for this, but might as well add the regression test for it. Change-Id: I84821f6615a26faf95e6f7c498aa3670f5d48a54 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312701 Reviewed-by: Stephen Adams Commit-Queue: Sigmund Cherem --- tests/web/regress/issue/52825_test.dart | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/web/regress/issue/52825_test.dart diff --git a/tests/web/regress/issue/52825_test.dart b/tests/web/regress/issue/52825_test.dart new file mode 100644 index 00000000000..4876b210ded --- /dev/null +++ b/tests/web/regress/issue/52825_test.dart @@ -0,0 +1,17 @@ +// Copyright (c) 2023, 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. + +// Regression test: inference error when returning a closure from an async +// function. +// +// For details, see: https://github.com/dart-lang/sdk/issues/52825 + +Future get getter async => + // The parameter `p` in this closure is accidentally treated as having + // an empty type mask. As a result `.toDouble` is tree-shaken. + // + // Adding an `await` circumvents this issue. + (int p) => p.toDouble(); + +main() => getter.then((double Function(int) f) => f(1));