Repository navigation
feat(diagnostics): locate E0104, name a continued if/match, add char_to_string #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1313,6 +1313,8 @@ let () = | |
| b "parse_float" (fun a -> Printf.sprintf "__as_parseFloat(%s)" (arg 0 a)); | ||
| b "char_to_int" (fun a -> Printf.sprintf "__as_charToInt(%s)" (arg 0 a)); | ||
| b "int_to_char" (fun a -> Printf.sprintf "__as_intToChar(%s)" (arg 0 a)); | ||
| (* A Char is a JS string of one code point, so this is the identity. *) | ||
| b "char_to_string" (fun a -> Printf.sprintf "String(%s)" (arg 0 a)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle characters returned by On Bun, Make the
|
||
| b "string_char_code_at" | ||
| (fun a -> Printf.sprintf "__as_strCharCodeAt(%s, %s)" (arg 0 a) (arg 1 a)); | ||
| b "string_from_char_code" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -900,6 +900,11 @@ let create_initial_env () : env = | |
| else Error (RuntimeError "int_to_char: code point out of ASCII range") | ||
| | _ -> Error (TypeMismatch "int_to_char expects Int") | ||
| )); | ||
| ("char_to_string", VBuiltin ("char_to_string", fun args -> | ||
| match args with | ||
| | [VChar c] -> Ok (VString (String.make 1 c)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve the character as valid UTF-8. For Make the interpreter's
|
||
| | _ -> Error (TypeMismatch "char_to_string expects Char") | ||
| )); | ||
| (* Byte-oriented String <-> Int accessors (see typecheck.ml bindings). | ||
| string_char_code_at returns the 0..255 byte at [i]; out-of-bounds | ||
| reads return -1 (mirroring string_find's "absent" sentinel rather | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limit the interpreter agreement claim.
The non-tail resume case at Lines 148–157 still produces a wrong interpreter result. Compiled backends also reject handlers, as recorded at Lines 132–139. Limit this claim to the cases fixed by
#833rather than all accepted programs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This row is ported verbatim from #856, so that
main's red ledger gate (property 3) goes green here. It must stay byte-identical, so that it becomes a no-op when #856 merges. A wording change to the #833 claim belongs on #856; I'm leaving this thread open for that.Generated by Claude Code