diff --git a/hkmc2/shared/src/test/mlscript/ucs/patterns/RestTuple.mls b/hkmc2/shared/src/test/mlscript/ucs/patterns/RestTuple.mls index e87ddce96..5a865cccc 100644 --- a/hkmc2/shared/src/test/mlscript/ucs/patterns/RestTuple.mls +++ b/hkmc2/shared/src/test/mlscript/ucs/patterns/RestTuple.mls @@ -1,8 +1,8 @@ :js :ucs desugared -fun tupleSlice(xs, i, j) = globalThis.Array.prototype.slice.call(xs, i, xs.length - j) -fun tupleGet(xs, i) = globalThis.Array.prototype.at.call(xs, i) +:import ../Prelude/Tuple.mls +//│ Imported 2 member(s) // Drop the first and last elements. tupleSlice([1, 2, 3, 4], 1, -1) @@ -23,7 +23,7 @@ fun stupid(xs) = if xs is //│ Desugared: //│ > if //│ > xs@59 is []>=0 and -//│ > let $rest@60 = globalThis:block#1#666.tupleSlice‹member:tupleSlice›(xs@59#2, 0, 0) +//│ > let $rest@60 = globalThis:import#Tuple#666.tupleSlice‹member:tupleSlice›(xs@59#2, 0, 0) //│ > let ys@61 = $rest@60#0 //│ > else ys@61#666 //│ > xs@59 is []=0 then "empty" @@ -58,8 +58,8 @@ fun foo(xs) = if xs is //│ > if //│ > xs@71 is []>=2 and //│ > let $first0@74 = xs@71#2.0 -//│ > let $rest@73 = globalThis:block#1#666.tupleSlice‹member:tupleSlice›(xs@71#3, 1, 1) -//│ > let $last0@72 = globalThis:block#1#666.tupleGet‹member:tupleGet›(xs@71#4, -1) +//│ > let $rest@73 = globalThis:import#Tuple#666.tupleSlice‹member:tupleSlice›(xs@71#3, 1, 1) +//│ > let $last0@72 = globalThis:import#Tuple#666.tupleGet‹member:tupleGet›(xs@71#4, -1) //│ > let x@75 = $first0@74#0 //│ > let ys@76 = $rest@73#0 //│ > let y@77 = $last0@72#0 @@ -108,8 +108,8 @@ fun nested_tuple_patterns(xs) = if xs is //│ > if //│ > xs@96 is []>=2 and //│ > let $first0@99 = xs@96#2.0 -//│ > let $rest@98 = globalThis:block#1#666.tupleSlice‹member:tupleSlice›(xs@96#3, 1, 1) -//│ > let $last0@97 = globalThis:block#1#666.tupleGet‹member:tupleGet›(xs@96#4, -1) +//│ > let $rest@98 = globalThis:import#Tuple#666.tupleSlice‹member:tupleSlice›(xs@96#3, 1, 1) +//│ > let $last0@97 = globalThis:import#Tuple#666.tupleGet‹member:tupleGet›(xs@96#4, -1) //│ > let x@100 = $first0@99#0 //│ > $rest@98 is []=2 and //│ > let $first0@102 = $rest@98#1.0 diff --git a/hkmc2/shared/src/test/mlscript/ucs/prelude/Tuple.mls b/hkmc2/shared/src/test/mlscript/ucs/prelude/Tuple.mls new file mode 100644 index 000000000..c0052ed86 --- /dev/null +++ b/hkmc2/shared/src/test/mlscript/ucs/prelude/Tuple.mls @@ -0,0 +1,2 @@ +fun tupleSlice(xs, i, j) = globalThis.Array.prototype.slice.call(xs, i, xs.length - j) +fun tupleGet(xs, i) = globalThis.Array.prototype.at.call(xs, i)