Pretty print state variables 'a instead of '1

This commit is contained in:
Hans Svensson
2019-05-27 15:59:13 +02:00
parent 5c98317a5a
commit 1ed40f1cca
2 changed files with 21 additions and 15 deletions
+8 -2
View File
@@ -1850,8 +1850,8 @@ instantiate(E) ->
instantiate1(dereference(E)).
instantiate1({uvar, Attr, R}) ->
Next = proplists:get_value(next, ets_lookup(type_vars, next), 1),
TVar = {tvar, Attr, "'" ++ integer_to_list(Next)},
Next = proplists:get_value(next, ets_lookup(type_vars, next), 0),
TVar = {tvar, Attr, "'" ++ integer_to_tvar(Next)},
ets_insert(type_vars, [{next, Next + 1}, {R, TVar}]),
TVar;
instantiate1({fun_t, Ann, Named, Args, Ret}) ->
@@ -1871,6 +1871,12 @@ instantiate1([A|B]) ->
instantiate1(X) ->
X.
integer_to_tvar(X) when X < 26 ->
[$a + X];
integer_to_tvar(X) ->
[integer_to_tvar(X div 26)] ++ [$a + (X rem 26)].
%% Save unification failures for error messages.
cannot_unify(A, B, When) ->