-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vm] Adjust return value of async/async*/sync* after the language spe…
…c change Calculation of element type for the value returned from async/async*/sync* functions was recently adjusted in the spec to address soundness issue (dart-lang/language#3218). This change adjusts Dart VM to conform to the new spec. TEST=language/async/regression_54311_test TEST=co19/Language/Functions/element_type_* Fixes #54316 Issue #54311 Issue #54159 Change-Id: I4c51e7cba704d034350519375210bdb2086c5432 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342082 Reviewed-by: Alexander Aprelev <[email protected]> Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
- Loading branch information
1 parent
e58efcb
commit 6b12473
Showing
4 changed files
with
73 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// 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. | ||
|
||
// Verifies that futureValueType(FutureOr<Object>) = Object. | ||
// | ||
// This is a special case because NORM(FutureOr<Object>) = Object, | ||
// and futureValueType(Object) = Object?, so futureValueType cannot be | ||
// applied to a normalized type. | ||
// | ||
// Regression test for https://github.com/dart-lang/sdk/issues/54311. | ||
|
||
import 'dart:async'; | ||
|
||
import "package:expect/expect.dart"; | ||
|
||
FutureOr<Object> fn1() async { | ||
return Future<Object>.value(42); | ||
} | ||
|
||
FutureOr<Object> fn2() async => 42; | ||
|
||
void main() async { | ||
final value1 = await fn1(); | ||
Expect.equals(42, value1); | ||
|
||
final value2 = await fn2(); | ||
Expect.equals(42, value2); | ||
} |