[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 <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2023-07-06 20:18:24 +00:00 committed by Commit Queue
parent 1199dc09b7
commit 8171191413

View file

@ -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<double Function(int)> 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));