-
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.
[stable] Fixing DDC record subtype checks crashing with numerics.
Bug: #52480 Change-Id: Iad9f6c986d4c445558c105abc66ad9b2a2812f25 Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/305560 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306307 Reviewed-by: Sigmund Cherem <[email protected]> Reviewed-by: Nicholas Shahan <[email protected]> Commit-Queue: Mark Zhou <[email protected]>
- Loading branch information
Showing
2 changed files
with
46 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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. | ||
|
||
// Tests record numeric subtyping rules with web semantics. | ||
// Regression test for https://github.com/dart-lang/sdk/issues/52480 | ||
|
||
import "package:expect/expect.dart"; | ||
|
||
main() { | ||
Expect.notSubtype<(int, int), (double, double)>(); | ||
Expect.notSubtype<(int, double), (double, double)>(); | ||
Expect.notSubtype<(double, double), (int, int)>(); | ||
Expect.notSubtype<(int, double), (int, int)>(); | ||
|
||
Object mixedTuple = (0, 0.1); | ||
(double, double) doubleTuple = (0.0, 0.1); | ||
Object someTuple = doubleTuple; | ||
|
||
Expect.type<(double, double)>(mixedTuple); | ||
Expect.type<(int, double)>(mixedTuple); | ||
Expect.type<(double, double)>(someTuple); | ||
Expect.type<(int, double)>(someTuple); | ||
|
||
dynamic dynamicIntTuple = (4, 4); | ||
dynamic dynamicDoubleTuple = doubleTuple; | ||
|
||
Expect.type<(int, int)>(dynamicIntTuple); | ||
Expect.type<(int, double)>(dynamicIntTuple); | ||
Expect.type<(double, int)>(dynamicIntTuple); | ||
Expect.type<(double, double)>(dynamicIntTuple); | ||
Expect.notType<(int, int)>(dynamicDoubleTuple); | ||
Expect.type<(int, double)>(dynamicDoubleTuple); | ||
Expect.notType<(double, int)>(dynamicDoubleTuple); | ||
Expect.type<(double, double)>(dynamicDoubleTuple); | ||
} |