<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>compile and syntax_tools disagree</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<BR>

<P><FONT SIZE=2 FACE="Arial">I'm getting a bit cross-eyed, but this has got to be a bug *somewhere*:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">12> M = [{attribute,1,module,m},{attribute,1,export,[{foo,1}]}|Fs] ++ [{eof,1}]. </FONT>

<BR><FONT SIZE=2 FACE="Arial">[{attribute,1,module,m},</FONT>

<BR><FONT SIZE=2 FACE="Arial"> {attribute,1,export,[{foo,1}]},</FONT>

<BR><FONT SIZE=2 FACE="Arial"> {function,1,</FONT>

<BR><FONT SIZE=2 FACE="Arial">           foo,</FONT>

<BR><FONT SIZE=2 FACE="Arial">           1,</FONT>

<BR><FONT SIZE=2 FACE="Arial">           [{clause,1,</FONT>

<BR><FONT SIZE=2 FACE="Arial">                    [{var,1,'R'}],</FONT>

<BR><FONT SIZE=2 FACE="Arial">                    [{op,1,'==',{var,1,'R'},{integer,1,1}}],</FONT>

<BR><FONT SIZE=2 FACE="Arial">                    [{atom,1,true}]}]},</FONT>

<BR><FONT SIZE=2 FACE="Arial"> {eof,1}]</FONT>

<BR><FONT SIZE=2 FACE="Arial">13> compile:forms(M).</FONT>

<BR><FONT SIZE=2 FACE="Arial">.:none: internal error in expand_module;</FONT>

<BR><FONT SIZE=2 FACE="Arial">crash reason: {function_clause,</FONT>

<BR><FONT SIZE=2 FACE="Arial">                  [{erl_expand_records,</FONT>

<BR><FONT SIZE=2 FACE="Arial">                       guard_tests1,</FONT>

<BR><FONT SIZE=2 FACE="Arial">                       [{op,1,'==',{var,1,'R'},{integer,1,1}},</FONT>

<BR><FONT SIZE=2 FACE="Arial">...</FONT>

<BR><FONT SIZE=2 FACE="Arial">                   {erl_expand_records,guard_tests,2},</FONT>

<BR><FONT SIZE=2 FACE="Arial">                   {erl_expand_records,guard,2},</FONT>

<BR><FONT SIZE=2 FACE="Arial">                   {erl_expand_records,clauses,2},</FONT>

<BR><FONT SIZE=2 FACE="Arial">                   {erl_expand_records,forms,2},</FONT>

<BR><FONT SIZE=2 FACE="Arial">                   {erl_expand_records,forms,2},</FONT>

<BR><FONT SIZE=2 FACE="Arial">                   {erl_expand_records,module,2},</FONT>

<BR><FONT SIZE=2 FACE="Arial">                   {sys_pre_expand,module,2}]}</FONT>

<BR><FONT SIZE=2 FACE="Arial">error</FONT>

<BR><FONT SIZE=2 FACE="Arial">14> M1 = [{attribute,1,module,m},{attribute,1,export,[{foo,1}]}|Fs1] ++ [{eof,1}].</FONT>

<BR><FONT SIZE=2 FACE="Arial">[{attribute,1,module,m},</FONT>

<BR><FONT SIZE=2 FACE="Arial"> {attribute,1,export,[{foo,1}]},</FONT>

<BR><FONT SIZE=2 FACE="Arial"> {function,1,</FONT>

<BR><FONT SIZE=2 FACE="Arial">           foo,</FONT>

<BR><FONT SIZE=2 FACE="Arial">           1,</FONT>

<BR><FONT SIZE=2 FACE="Arial">           [{clause,1,</FONT>

<BR><FONT SIZE=2 FACE="Arial">                    [{var,1,'R'}],</FONT>

<BR><FONT SIZE=2 FACE="Arial">                    [[{op,1,'==',{var,1,'R'},{integer,1,1}}]],</FONT>

<BR><FONT SIZE=2 FACE="Arial">                    [{atom,1,true}]}]},</FONT>

<BR><FONT SIZE=2 FACE="Arial"> {eof,1}]</FONT>

<BR><FONT SIZE=2 FACE="Arial">15> compile:forms(M1).                                                          {ok,m,</FONT>

<BR><FONT SIZE=2 FACE="Arial">    <<70,79,82,49,0,0,1,184,66,69,65,77,65,116,111,109,0,0,0,50,0,0,0,6,1,109,</FONT>

<BR><FONT SIZE=2 FACE="Arial">      ...>>}</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">When pretty-printing the two form lists using erl_prettypr:format/2, </FONT>

<BR><FONT SIZE=2 FACE="Arial">you get the same output, and according to the ERTS User's Guide,</FONT>

<BR><FONT SIZE=2 FACE="Arial">the two guard representations should be equivalent. A list of lists</FONT>

<BR><FONT SIZE=2 FACE="Arial">in the Guard represents a disjunction, and a list of Guard expressions</FONT>

<BR><FONT SIZE=2 FACE="Arial">represents a conjunction. In this case, there's only one guard expr.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">6> erl_prettypr:format(erl_syntax:form_list(Fs)).</FONT>

<BR><FONT SIZE=2 FACE="Arial">"foo(R) when R == 1 -> true."      </FONT>

<BR><FONT SIZE=2 FACE="Arial">6> erl_prettypr:format(erl_syntax:form_list(Fs1)).</FONT>

<BR><FONT SIZE=2 FACE="Arial">"foo(R) when R == 1 -> true."      </FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">It seems to me as if the bug is in the compiler (version 4.4.3).</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Forgive me for not diving into the compiler source code to verify</FONT>

<BR><FONT SIZE=2 FACE="Arial">this claim. Time to put the kids to sleep.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">BR,</FONT>

<BR><FONT SIZE=2 FACE="Arial">Ulf W</FONT>
</P>

</BODY>
</HTML>