Skip to content

Commit d4a99f9

Browse files
authored
chore(compiler): Stabilize snapshots (#2107)
1 parent 4275c17 commit d4a99f9

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

compiler/test/suites/optimizations.re

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ open Grain_middle_end.Anf_helper;
55
open Grain_utils;
66
open Grain_parsing;
77

8+
// Prevent updating stamps for consistent snapshots
9+
let gensym = Grain_typed.Ident.(name => {name, stamp: 0, flags: 0});
10+
811
describe("optimizations", ({test, testSkip}) => {
912
let test_or_skip =
1013
Sys.backend_type == Other("js_of_ocaml") ? testSkip : test;
@@ -150,7 +153,7 @@ describe("optimizations", ({test, testSkip}) => {
150153
"((x) => {\n let x = 4;\n let y = x;\n x})",
151154
{
152155
open Grain_typed;
153-
let x = Ident.create("lambda_arg");
156+
let x = gensym("lambda_arg");
154157
AExp.comp(
155158
~loc=Location.dummy_loc,
156159
Comp.lambda(
@@ -208,7 +211,7 @@ describe("optimizations", ({test, testSkip}) => {
208211
"((x) => {let a = (x, 1); let b = (x, 1); (x, 1)})",
209212
{
210213
open Grain_typed;
211-
let arg = Ident.create("lambda_arg");
214+
let arg = gensym("lambda_arg");
212215
AExp.comp(
213216
~loc=Location.dummy_loc,
214217
Comp.lambda(~loc=Location.dummy_loc, [(arg, Managed)]) @@
@@ -236,7 +239,7 @@ describe("optimizations", ({test, testSkip}) => {
236239
"((x) => {1})",
237240
{
238241
open Grain_typed;
239-
let x = Ident.create("lambda_arg");
242+
let x = gensym("lambda_arg");
240243
AExp.comp(
241244
~loc=Location.dummy_loc,
242245
Comp.lambda(
@@ -265,8 +268,8 @@ describe("optimizations", ({test, testSkip}) => {
265268
"provide let foo = () => {let mut x = 5; x = 6}",
266269
{
267270
open Grain_typed;
268-
let foo = Ident.create("foo");
269-
let x = Ident.create("x");
271+
let foo = gensym("foo");
272+
let x = gensym("x");
270273
AExp.let_(
271274
~loc=Location.dummy_loc,
272275
Nonrecursive,
@@ -330,9 +333,9 @@ describe("optimizations", ({test, testSkip}) => {
330333
"provide let bar = () => { let mut x = 5; let foo = () => x; foo() }",
331334
{
332335
open Grain_typed;
333-
let x = Ident.create("x");
334-
let bar = Ident.create("bar");
335-
let foo = Ident.create("foo");
336+
let x = gensym("x");
337+
let bar = gensym("bar");
338+
let foo = gensym("foo");
336339
AExp.let_(
337340
~loc=Location.dummy_loc,
338341
Nonrecursive,
@@ -420,10 +423,10 @@ describe("optimizations", ({test, testSkip}) => {
420423
"{\n let x = 5;\n let foo = ((y) => {y});\n let y = (3, 5);\n foo(3) + x}",
421424
{
422425
open Grain_typed;
423-
let plus = Ident.create("+");
424-
let foo = Ident.create("foo");
425-
let arg = Ident.create("lambda_arg");
426-
let app = Ident.create("app");
426+
let plus = gensym("+");
427+
let foo = gensym("foo");
428+
let arg = gensym("lambda_arg");
429+
let app = gensym("app");
427430
AExp.let_(
428431
~loc=Location.dummy_loc,
429432
Nonrecursive,
@@ -529,10 +532,10 @@ describe("optimizations", ({test, testSkip}) => {
529532
|},
530533
{
531534
open Grain_typed;
532-
let plus = Ident.create("+");
533-
let foo = Ident.create("foo");
534-
let arg = Ident.create("lambda_arg");
535-
let app = Ident.create("app");
535+
let plus = gensym("+");
536+
let foo = gensym("foo");
537+
let arg = gensym("lambda_arg");
538+
let app = gensym("app");
536539
AExp.let_(
537540
~loc=Location.dummy_loc,
538541
~global=Global,
@@ -616,9 +619,9 @@ describe("optimizations", ({test, testSkip}) => {
616619
|},
617620
{
618621
open Grain_typed;
619-
let foo = Ident.create("foo");
620-
let fill = Ident.create("fill");
621-
let copy = Ident.create("copy");
622+
let foo = gensym("foo");
623+
let fill = gensym("fill");
624+
let copy = gensym("copy");
622625
AExp.let_(
623626
~loc=Location.dummy_loc,
624627
~global=Global,
@@ -716,7 +719,7 @@ describe("optimizations", ({test, testSkip}) => {
716719
|},
717720
{
718721
open Grain_typed;
719-
let foo = Ident.create("foo");
722+
let foo = gensym("foo");
720723
AExp.let_(
721724
~loc=Location.dummy_loc,
722725
~global=Global,

0 commit comments

Comments
 (0)