Open OvermindDL1 opened 5 years ago
Thanks @OvermindDL1! We're aware that self-gradualization doesn't work just yet. Indeed, we just recently celebrated that the gradualizer doesn't crash when run on itself.
Since the gradualizer is not what you would call a typical Erlang program, I haven't made it a priority to get self-gradualization to work. I've focused on programs that most people write.
That being said, we certainly want to make this work eventually. So thanks for opening this ticket.
Thanks @OvermindDL1! We're aware that self-gradualization doesn't work just yet. Indeed, we just recently celebrated that the gradualizer doesn't crash when run on itself.
I figured, it's mostly just for fun as well as it's a useful issue to have as a Target since I didn't see one otherwise. :-)
Since the gradualizer is not what you would call a typical Erlang program, I haven't made it a priority to get self-gradualization to work. I've focused on programs that most people write.
As has been learned by the Elixir's Dialyxir project, any possible type that is representable by the BEAM is indeed used in the wild far more often than you'd think, so even Gradualizer itself is still a 'usual' erlang program. :-)
Only partially fixed, right?
@Zalastax, indeed! The ticket was automatically closed by github. Thanks for reopening it.
It would nice to require that gradualizer doesn't crash when checking itself. Perhaps we can add that to the .travis file?
Sometimes these crashes are fixed but every now and then, we introduce new crashes. Currently, I get this crash:
$ make gradualize
rebar3 escriptize
===> Verifying dependencies...
===> Compiling gradualizer
===> Building escript...
cp _build/default/bin/gradualizer .
./gradualizer -pa src/ src/*.erl
src/constraints.erl: The record field Cs#constraints.exist_vars on line 21 at column 58 is expected to have type set(Element) but it has type sets:set(string())
src/constraints.erl: The record field C1#constraints.exist_vars on line 50 at column 40 is expected to have type set(Element) but it has type sets:set(string())
src/gradualizer.erl: The variable Forms on line 52 at column 36 is expected to have type [erl_parse:abstract_form()] but it has type [erl_parse:abstract_form() | erl_parse:form_info()]
src/gradualizer.erl: The variable File on line 69 at column 29 is expected to have type file:filename() but it has type cover_compiled | non_existing | preloaded | [char()]
src/gradualizer.erl: The function filename:join on line {87,55} is expected to return atom() | [char()] | [char() | atom() | deep_list()] but it returns file:filename_all()
escript: exception error: no case clause matching false
in function typechecker:list_op_arg_types/2 (/home/viktor/repos/gradualizer/_build/default/lib/gradualizer/src/typechecker.erl, line 2529)
in call from typechecker:type_check_list_op_in/6 (/home/viktor/repos/gradualizer/_build/default/lib/gradualizer/src/typechecker.erl, line 2506)
in call from typechecker:type_check_expr_in/3 (/home/viktor/repos/gradualizer/_build/default/lib/gradualizer/src/typechecker.erl, line 1962)
in call from typechecker:check_clause/4 (/home/viktor/repos/gradualizer/_build/default/lib/gradualizer/src/typechecker.erl, line 3024)
in call from typechecker:'-check_clauses/4-fun-0-'/4 (/home/viktor/repos/gradualizer/_build/default/lib/gradualizer/src/typechecker.erl, line 2999)
in call from lists:foldl/3 (lists.erl, line 1263)
in call from typechecker:check_clauses/4 (/home/viktor/repos/gradualizer/_build/default/lib/gradualizer/src/typechecker.erl, line 2997)
in call from typechecker:do_type_check_expr_in/3 (/home/viktor/repos/gradualizer/_build/default/lib/gradualizer/src/typechecker.erl, line 2179)
make: *** [Makefile:50: gradualize] Error 127
@zuiderkwast I can add that to the CI!
That's great @Zalastax :star: but before we merge that, we should fix the crash too I guess.
As a test to see how it ran, I ran Gradualizer on Gradualizer itself, there are a few issues, and they do seem to be legitimate:
And it looks like there is a crash of Gradualizer itself within all that as well.