Skip to content

Commit dd27b43

Browse files
nshahanCommit Queue
authored and
Commit Queue
committed
[tests] Add void value in record regression test
Issue: #52593 Change-Id: I493da856cea05ab8cbb01900d1df3d423ce46f59 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308244 Reviewed-by: Mark Zhou <[email protected]>
1 parent 06f2218 commit dd27b43

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
/// Regression test for https://github.com/dart-lang/sdk/issues/52593.
6+
///
7+
/// Adding the value returned from a method with a static return type of `void`
8+
/// to a record and getting the value should not cause a runtime error.
9+
10+
import 'package:expect/expect.dart';
11+
12+
(Object?,) fn1() => (fn2() as Object?,);
13+
void fn2() {}
14+
15+
@pragma('dart2js:noInline')
16+
@pragma('dart2js:assumeDynamic')
17+
confuse(x) {
18+
return x;
19+
}
20+
21+
void main() {
22+
var r = fn1();
23+
Expect.isNull(r.$1);
24+
var d = confuse(fn1());
25+
Expect.isNull(d.$1);
26+
}

0 commit comments

Comments
 (0)