Skip to content

Commit bbad90d

Browse files
committed
Add bug repros and a small fix
1 parent f151d58 commit bbad90d

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

hkmc2/shared/src/test/mlscript-compile/apps/CSV.mls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fun toArrays(strData) =
5050
// Now that we have our delimiter out of the way,
5151
// let's check to see which kind of value we captured (quoted or unquoted).
5252
let strMatchedValue =
53-
if arrMatches.2
53+
if arrMatches.2 !== undefined
5454
then
5555
// We found a quoted value. When we capture this value, unescape any double quotes.
5656
arrMatches.2.replace of

hkmc2/shared/src/test/mlscript/backlog/ToTriage.mls

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,4 +386,27 @@ if Foo(1, 2, 3) is Foo(arg) then arg
386386
//│ ═══[RUNTIME ERROR] Error: match error
387387

388388
// ——— ——— ———
389+
// [SERIOUS]
390+
391+
module M with
392+
val name = "Student"
393+
//│ ═══[RUNTIME ERROR] TypeError: Cannot assign to read only property 'name' of function 'class M { static { M1 = M; this.name = "Student"; } static toString() { return "M"; } }'
394+
395+
// ——— ——— ———
396+
397+
val outFilePath = "out/test.md"
398+
//│ outFilePath = "out/test.md"
399+
400+
// FIXME: should wrap in `safeCall`
401+
:sjs
402+
fun w(txt) =
403+
fs.writeFileSync(outFilePath, txt)
404+
// ()
405+
//│ JS (unsanitized):
406+
//│ let w; w = function w(txt) { return globalThis.fs.writeFileSync(outFilePath, txt) };
407+
408+
w("whoops")
409+
//│ ═══[RUNTIME ERROR] Error: MLscript call unexpectedly returned `undefined`, the forbidden value.
410+
411+
// ——— ——— ———
389412

out/test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
whoops

0 commit comments

Comments
 (0)