40e18905f2
Closes https://github.com/dart-lang/sdk/pull/49478 TEST=Manual GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902 Reviewed-by: Michael Thomsen <mit@google.com> Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com> Reviewed-by: Alexander Thomas <athom@google.com>
29 lines
772 B
Dart
29 lines
772 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.
|
|
|
|
// Regression test which checks that shift left with constant operand compiles
|
|
// correctly even if narrowed to Int32 shift.
|
|
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
const int N = 10;
|
|
|
|
@pragma('vm:never-inline')
|
|
void test(Int32List v) {
|
|
// The shape of the code here is chosen to trigger Int64->Int32
|
|
// narrowing in the range analysis.
|
|
v[0] = (v[0] & 0xFF) << (N - 1);
|
|
}
|
|
|
|
void main() {
|
|
final list = Int32List(1);
|
|
for (var i = 0; i < 10; i++) {
|
|
list[0] = i;
|
|
test(list);
|
|
Expect.equals(i << 9, list[0]);
|
|
}
|
|
}
|