Safe and named fresh type variables #20
Labels
bug
Something isn't working
compiler
Related to the OCaml to Erlang compiler
good first issue
Good for newcomers
In this commit: e916333 I've replaced all instances of fresh type variables with
any
, in an attempt to unblock #19 -- after all those type signatures are not necessary for the Erlang code to compile and execute.However, I do want to have this feature available, but it has one problem: a signature like
unit -> 'a
is valid in OCaml, butfun( () -> A )
is not in Erlang.Thus, to really fix this, the commit above should be reverted, and during translation time we should check if the fresh variable name is actually already bound before in the same type expression, or if it is the only instance of it.
If it is the only instance, then we can use
any()
instead.To fix this, we should begin by applying this patch:
At the end of this module we should map over the list of types and for every function type we should have a data structure with all the data we need in a fairly straightforward form:
Type_function { tyfun_args; tyfun_return; }
And if the return type is a type variable name that was not bound in the arguments, we can loosen it up with
Type.any
instead.The text was updated successfully, but these errors were encountered: