Rolling back e9163337e275e895195b58e38986a97a8ebb1687. + Changing the logic of handling type variables in specs:
If a generated/translated spec has a type variable which is used exactly once (erl_lint calls such variables "unbound variables"), such a variable is replaced with the wildcard type variable (_). This makes erlc/erl_lint happy about generated code.
Snapshot tests are updated accordingly.
Subtlety
This new logic doesn't try to distinguish "original" (but also unbound for erlc) OCaml type variables and inferred type variables: if a type variable is unbound it will be replaced by _ anyway.
To always prefix unbound variable with _, eg the unbound type variable _X is totally fine for erl_lint and falls into the category "I don't care".
To introduce some logic to distinguish "original" type variables (like in where_is) and to not replace them with _.
More idiomatic OCaml code in erlang/src/erl_ast_helper.ml - I did not read many parts of the project in detail, - so my code is likely not of the same style as the rest of the project.
Fixes #20
Change
Rolling back e9163337e275e895195b58e38986a97a8ebb1687. + Changing the logic of handling type variables in specs:
If a generated/translated spec has a type variable which is used exactly once (
erl_lint
calls such variables "unbound variables"), such a variable is replaced with the wildcard type variable (_
). This makeserlc
/erl_lint
happy about generated code.Snapshot tests are updated accordingly.
Subtlety
This new logic doesn't try to distinguish "original" (but also unbound for
erlc
) OCaml type variables and inferred type variables: if a type variable is unbound it will be replaced by_
anyway.This makes this example less idiomatic:
Before:
After:
Possible improvement(s)
_
, eg the unbound type variable_X
is totally fine forerl_lint
and falls into the category "I don't care".where_is
) and to not replace them with_
.erlang/src/erl_ast_helper.ml
- I did not read many parts of the project in detail, - so my code is likely not of the same style as the rest of the project.Thanks for a really cool and interesting project!