merge esl and uwiger repos

This commit is contained in:
Ulf Wiger 2013-12-12 14:36:30 +01:00
commit 45e4d9a25f
4 changed files with 29 additions and 19 deletions

View File

@ -1,12 +1,15 @@
REBAR=$(shell which rebar || echo ./rebar) REBAR=$(shell which rebar || echo ./rebar)
.PHONY: rel all clean .PHONY: rel all deps clean
all: compile all: deps compile
compile: compile:
$(REBAR) compile $(REBAR) compile
deps:
./rebar get-deps
clean: clean:
$(REBAR) clean $(REBAR) clean

View File

@ -14,13 +14,13 @@ test_exprecs.beam: ../ebin/exprecs.beam test_exprecs.erl
@echo Compiling test_exprecs.erl @echo Compiling test_exprecs.erl
@erlc +debug_info -pa ../ebin -pa . -I ../include test_exprecs.erl @erlc +debug_info -pa ../ebin -pa . -I ../include test_exprecs.erl
test.beam: test_pt.beam
ex_pmod.beam: pmod.beam
%.beam: %.erl $(HEADERS) %.beam: %.erl $(HEADERS)
@echo Compiling $< @echo Compiling $<
@erlc +debug_info -pa ../ebin -pa . -I ../include $< @erlc +debug_info -pa ../ebin -pa . -I ../include $<
test.beam: test_pt.beam
clean: clean:
@echo Cleaning @echo Cleaning
@rm -f *.beam @rm -f *.beam

BIN
rebar vendored

Binary file not shown.

View File

@ -142,9 +142,8 @@
%% '#pos-'(s, Attr) -&gt; %% '#pos-'(s, Attr) -&gt;
%% '#pos-s'(Attr). %% '#pos-s'(Attr).
%% %%
%% -spec '#is_record-'(#r{}) -&gt; true; %% -spec '#is_record-'(any()) -&gt; boolean().
%% (#s{}) -&gt; true; %%
%% (any()) -&gt; false.
%% '#is_record-'(X) -&gt; %% '#is_record-'(X) -&gt;
%% if %% if
%% is_record(X, r) -&gt; %% is_record(X, r) -&gt;
@ -155,9 +154,8 @@
%% false %% false
%% end. %% end.
%% %%
%% -spec '#is_record-'(r, #r{}) -&gt; true; %% -spec '#is_record-'(any(), any()) -&gt; boolean().
%% (s, #s{}) -&gt; true; %%
%% (any(), any()) -&gt; false.
%% '#is_record-'(s, Rec) when tuple_size(Rec) == 2, element(1, Rec) == s -&gt; %% '#is_record-'(s, Rec) when tuple_size(Rec) == 2, element(1, Rec) == s -&gt;
%% true; %% true;
%% '#is_record-'(r, Rec) when tuple_size(Rec) == 4, element(1, Rec) == r -&gt; %% '#is_record-'(r, Rec) when tuple_size(Rec) == 4, element(1, Rec) == r -&gt;
@ -836,6 +834,7 @@ t_integer(L, I) -> {integer, L, I}.
t_list(L, Es) -> {type, L, list, Es}. t_list(L, Es) -> {type, L, list, Es}.
t_fun(L, As, Res) -> {type, L, 'fun', [{type, L, product, As}, Res]}. t_fun(L, As, Res) -> {type, L, 'fun', [{type, L, product, As}, Res]}.
t_tuple(L, Es) -> {type, L, tuple, Es}. t_tuple(L, Es) -> {type, L, tuple, Es}.
t_boolean(L) -> {type, L, boolean, []}.
t_record(L, A) -> {type, L, record, [{atom, L, A}]}. t_record(L, A) -> {type, L, record, [{atom, L, A}]}.
f_set_2(Rname, Flds, L, Acc) -> f_set_2(Rname, Flds, L, Acc) ->
@ -1013,10 +1012,14 @@ f_info(Acc, L) ->
f_isrec_2(#pass1{records = Rs, exports = Es} = Acc, L) -> f_isrec_2(#pass1{records = Rs, exports = Es} = Acc, L) ->
Fname = list_to_atom(fname_prefix(is_record, Acc)), Fname = list_to_atom(fname_prefix(is_record, Acc)),
Info = [{R,length(As) + 1} || {R,As} <- Rs, lists:member(R, Es)], Info = [{R,length(As) + 1} || {R,As} <- Rs, lists:member(R, Es)],
[funspec(L, Fname, [%% This contract is correct, but is ignored by Dialyzer because it
[{[t_atom(L, R), t_record(L, R)], t_atom(L, true)} %% has overlapping domains:
|| R <- Es] ++ %% funspec(L, Fname,
[{[t_any(L), t_any(L)], t_atom(L, false)}]), %% [{[t_atom(L, R), t_record(L, R)], t_atom(L, true)}
%% || R <- Es] ++
%% [{[t_any(L), t_any(L)], t_atom(L, false)}]),
%% This is less specific, but more useful to Dialyzer:
funspec(L, Fname, [{[t_any(L), t_any(L)], t_boolean(L)}]),
{function, L, Fname, 2, {function, L, Fname, 2,
lists:map( lists:map(
fun({R, Ln}) -> fun({R, Ln}) ->
@ -1091,10 +1094,14 @@ f_pos_2(#pass1{exports = Es} = Acc, L) ->
f_isrec_1(Acc, L) -> f_isrec_1(Acc, L) ->
Fname = list_to_atom(fname_prefix(is_record, Acc)), Fname = list_to_atom(fname_prefix(is_record, Acc)),
[funspec(L, Fname, [%% This contract is correct, but is ignored by Dialyzer because it
[{[t_record(L, R)], t_atom(L, true)} %% has overlapping domains:
|| R <- Acc#pass1.exports] %% funspec(L, Fname,
++ [{[t_any(L)], t_atom(L, false)}]), %% [{[t_record(L, R)], t_atom(L, true)}
%% || R <- Acc#pass1.exports]
%% ++ [{[t_any(L)], t_atom(L, false)}]),
%% This is less specific, but more useful to Dialyzer:
funspec(L, Fname, [{[t_any(L)], t_boolean(L)}]),
{function, L, Fname, 1, {function, L, Fname, 1,
[{clause, L, [{clause, L,
[{var, L, 'X'}], [{var, L, 'X'}],