CakeML / CakeML/cakeml

Translator fails coersion when the char list gets stuck in the list

Open
#1,318 3 comments 0 reactions 0 assignees View on GitHub
low priority low reward translator
Dominant language
Standard ML
Stars
1.2k
Forks
104
Avg merge
2d 21h
Merged PRs (30d)
16

Description

When ml_translatorLib.use_string_type is enabled it can fail when the constraint is such that a `f (LIST_TYPE CHAR)` where instead `f HOL_STRING_TYPE` is desired instead. See this repro.
```
Definition foo_char_list_def:
foo_char_list = "foo"
End
Definition repro_def:
repro xs = let ys = MAP (\x. IMPLODE foo_char_list) xs
in EXPLODE (HD ys)
End
Definition repro2_def:
repro2 xs = let ys = MAP (\x. foo_char_list) xs
in EXPLODE (HD ys)
End
ml_translatorLib.use_string_type false;
translate foo_char_list_def;
ml_translatorLib.use_string_type true;
translate repro_def (*works *)
translate repro2_def (*fails *)
````

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied repro with ml_translatorLib.use_string_type set to false and true, comparing repro_def with repro2_def. Trace how the translator handles foo_char_list as a LIST_TYPE CHAR versus HOL_STRING_TYPE. Done means repro2_def translates successfully with string types enabled.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.