Files
sdk/tests/language/vm/regress_36589_test.dart
T
Robert Nystrom 2034061433 Migrate language_2/vm to NNBD.
Change-Id: I313a57ed7c7ea2ada75065f55a7367376f6bdae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152183
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-06-25 20:39:23 +00:00

70 lines
1.3 KiB
Dart

// Copyright (c) 2019, 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.
// Non-smi constant indices for load and store indexed (dartbug.com/36589).
//
// VMOptions=--deterministic --optimization_counter_threshold=5
import "package:expect/expect.dart";
List<int?> mX = new List.filled(1, null);
@pragma('vm:never-inline')
int? foo() {
return mX[8589934591];
}
@pragma('vm:never-inline')
foo_store() {
mX[8589934591] = 0;
}
@pragma('vm:never-inline')
int? bar() {
List<int?> x = new List.filled(1, null);
return x[8589934591];
}
@pragma('vm:never-inline')
bar_store() {
List<int?> x = new List.filled(1, null);
x[8589934591] = 0;
}
main() {
int i = 0;
for (int j = 0; j < 10; j++) {
try {
i = foo()!;
} catch (e, s) {
i++;
}
}
Expect.equals(10, i);
for (int j = 0; j < 10; j++) {
try {
foo_store();
} catch (e, s) {
i++;
}
}
Expect.equals(20, i);
for (int j = 0; j < 10; j++) {
try {
i = bar()!;
} catch (e, s) {
i++;
}
}
Expect.equals(30, i);
for (int j = 0; j < 10; j++) {
try {
bar_store();
} catch (e, s) {
i++;
}
}
Expect.equals(40, i);
}