Skip to content
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

tyenv_bug #42

Merged
merged 2 commits into from
Nov 18, 2024
Merged

Conversation

oshimayuki1124
Copy link
Contributor

If you run programs below,

let f = fun x -> x;;
let f = fun x -> x f;;
f (fun x -> x) 4;;

ldti raise an error
Fatal error: exception Lambda_dti.Typing.Type_bug("failed to cast tyarg to ty")

This arose in CC.type_of_exp because fun x -> x f type in the second line is concidered under an environment which contain type information of the second f, not first one.
To fix this problem, I added some changes.

  • typing.ml, typing.mli
    • omit tyenv from return values of ITGL.type_of_program
    • add type information into tyenv correctly in translate
  • main.ml, test_examples.ml, stdlib.ml
    • follow the change about return values of ITGL.type_of_program
    • normalize tyenv and pass it to translate, CC.type_of_program
    • update tyenv with new_tyenv from translate
  • test_typing.ml
    • follow the change about return values of ITGL.type_of_program

@ymyzk
Copy link
Owner

ymyzk commented Nov 18, 2024

@oshimayuki1124 Thank you very much for your contribution! The change looks good to me. I'll merge the change once the CI pipeline succeeds.

@ymyzk ymyzk merged commit e0bb51e into ymyzk:master Nov 18, 2024
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants