08f90cad84
JSDouble represents doubles that are not integers. It is usually wrong to use JSDouble, so use JSNumber instead where we mean 'all double values'. This fixes #44818 by not mistakenly pretending that division cannot have an integral result. Will follow up with a CL to rename JSDouble. Fixed: 44818 Change-Id: Ic324df2ee1f2c7434bc0b064c0dbd7b6800ad93b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183360 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
22 lines
582 B
Dart
22 lines
582 B
Dart
// Copyright (c) 2021, 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.
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
// Regression test for mis-optimized (a / b).runtimeType.
|
|
|
|
void main() {
|
|
Type t0;
|
|
Type t1;
|
|
for (int i = 0; i < 2; i++) {
|
|
t0 = i.runtimeType;
|
|
t1 = ((i * 2) / 2).runtimeType;
|
|
}
|
|
final t2 = ((0 * 2) / 2).runtimeType;
|
|
|
|
Expect.equals('int', '$t0');
|
|
Expect.equals('int', '$t1');
|
|
Expect.equals('int', '$t2');
|
|
}
|