another bounds example - catched by normal compile but not by dialyzer

Roger Larsson <>
Tue Jun 27 09:16:13 CEST 2006


Furter experimentation:
* Static checking of array bounds is a simpler problem than handling dynamic 
lists.
So, lets try the same kind of errors with tuples.

Normal compile detects these simple cases. But dialyzer
return some strange messages.
At least the dialyzer output is hard to decipher...

	-module(bounds).
	-export([detect/0, wrong_match/0]).

	detect() -> element(4, {1, 2, 3}).
	wrong_match() -> {_, _, _, _} = {1, 2, 3}.

> erl
1> c(bounds).
./bounds.erl:4: Warning: this expression would cause a 'badarg' exception at 
run-time
./bounds.erl:5: Warning: this clause cannot match because of different 
types/sizes
{ok,bounds}

> dialyzer (from source)
{bounds,detect,0}: Function has no local return
{bounds,wrong_match,0}: Function has no local return

/RogerL



More information about the erlang-questions mailing list