dialyzer?

107 views
Skip to first unread message

Raoul Duke

unread,
Apr 30, 2015, 8:54:49 PM4/30/15
to lisp-flavo...@googlegroups.com
how goes it? :-) just a plug to say this is exciting! keep going! :-)

p.s. i think it should be "lisp-flavoured-erlang" you know.

Robert Virding

unread,
May 3, 2015, 12:58:13 PM5/3/15
to lisp-flavo...@googlegroups.com
You can test the current dialyzer interface by checkoing out the dev-dialyzer branch. It adds some file to src and a new command ldialyzer which runs a dialyzer which assumes src files are .lfe, which it can handle. So you can check .beam files and .lfe files together, but there is no way to check .erl files at the same time.

Please test it,

Robert

Raoul Duke

unread,
May 4, 2015, 8:36:44 PM5/4/15
to lisp-flavo...@googlegroups.com
I don't know what I'm doing.

$ cat hw.lfe
(io:format "hello world~n")

$ ldialyzer hw.lfe
Checking whether the PLT /Users/x/.dialyzer_plt is up-to-date...
dialyzer: Could not find the PLT: /Users/x/.dialyzer_plt

$ dialyzer --build_plt hw.lfe
dialyzer: Could not get abstract code for file:
/Users/x/Dev/lfe/hw.lfe (please recompile it with +debug_info)

Robert Virding

unread,
May 4, 2015, 10:42:36 PM5/4/15
to lisp-flavo...@googlegroups.com
You need to build a ~/.dialyzer_plt file:

dialyzer --build_plt --apps erts stdlib kernel

It takes a long time. Then you can use dialyzer. http://erlang.org/doc/man/dialyzer.html

Robert

Raoul Duke

unread,
May 5, 2015, 1:49:44 PM5/5/15
to lisp-flavo...@googlegroups.com
ok did that. now it still complains:

$ dialyzer --build_plt --apps erts stdlib kernel
Compiling some key modules to native code... done in 0m14.80s
Creating PLT /Users/x/.dialyzer_plt ...
Unknown functions:
compile:file/2
compile:forms/2
compile:noenv_forms/2
compile:output_generated/1
crypto:block_decrypt/4
crypto:start/0
Unknown types:
compile:option/0
done in 0m27.48s
done (passed successfully)

$ ldialyzer hw.lfe
Checking whether the PLT /Users/x/.dialyzer_plt is up-to-date... yes
Proceeding with analysis...
dialyzer: Analysis failed with error:
Could not scan the following file(s):
Could not get abstract code for: /Users/x/Dev/lfe/hw.lfe
Recompile with +debug_info or analyze starting from source code
Last messages in the log cache:
Reading files and computing callgraph...

Raoul Duke

unread,
May 5, 2015, 1:53:51 PM5/5/15
to lisp-flavo...@googlegroups.com
(defmodule hello-world
(export all))
(defun doit ()
(io:format "hello world~n"))


ldialyzer --src hw.lfe
Checking whether the PLT /Users/jonslenk/.dialyzer_plt is up-to-date... yes
Proceeding with analysis... done in 0m0.47s
done (passed successfully)

Raoul Duke

unread,
May 5, 2015, 1:57:19 PM5/5/15
to lisp-flavo...@googlegroups.com
obviously my utter ignorance of all things (it has been a long time
since i've had any free time to muck with the erlang ecosystem) isn't
going to make me a good tester here ;-) ;-)

one possibly crazy testing approach would be: if there were a
converter from Erlang standard syntax over to LFE, and then you could
run both version through Dialyzer and compare the resulting output.
Ideally it would be the same?

Robert Virding

unread,
May 5, 2015, 5:58:53 PM5/5/15
to lisp-flavo...@googlegroups.com
The ldialyzer interface is exactly the same as for the normal dialyzer except the --src now defaults to .lfe files. I personally think that it is a terrible interface, an example of how not to do it. My goal with ldialyzer is that it will be able to handle .beam, .erl and .lfe files. It would actually be not too difficult to make it pluggable, it would just take some time to wade through the interface code and clean it up and fix it.

Robert

Dialyzer interface delenda est

Feng Hou

unread,
Sep 21, 2015, 1:20:23 AM9/21/15
to Lisp Flavoured Erlang
Hello,

Will ldialyzer in dev-dialyzer branch be updated with next release? 

Sometimes, file name is missing in error output.. for example, the first error shows only line number ':4:' (see below for actually file). The second error from another file is fine.

~ > ldialyzer --src lfe/*.lfe                                                       

  Checking whether the PLT /Users/houf/.dialyzer_plt is up-to-date... yes

  Proceeding with analysis...

:4: The pattern 'false' can never match the type 'else'

:4: The pattern 'true' can never match the type 'else'

crypto-json.lfe:11: Call to missing or unexported function lists:keymap/2

Unknown functions:

  mochijson2:decode/1

 done in 0m0.79s

done (warnings were emitted)


--- gcd.lfe----
(defmodule gcd
  (export  (gcd 2)))

(defun gcd (m n) 
  (cond ((== m n) m)
        ((>= m n) (gcd (- m n) n))
        ('else (gcd m (- n m)))))  

Regards,
Feng

Robert Virding

unread,
Sep 21, 2015, 8:10:19 AM9/21/15
to Lisp Flavoured Erlang
LFE dialyzer is more to be viewed as proof of concept at them moment rather than something production ready. Hence its own branch, which is way behind 'develop' at the moment. It definitely needs work and I will try to get it up to scratch. One problem will be interfacing it with the new compiler which can do many modules in one source file. LFE dialyzer must currently work with source files due to how dialyzer works and how .beam files work.

Robert
Reply all
Reply to author
Forward
0 new messages