[m-rev.] diff: fix casting dummy variables in erlang

Peter Wang wangp at students.csse.unimelb.edu.au
Fri Aug 24 15:11:40 AEST 2007


Estimated hours taken: 0.5
Branches: main

compiler/erl_call_gen.m:
	Fix a bug when casting a dummy variable to a variable of a non-dummy
	type.  The dummy variable may not exist so the non-dummy variable must
	be assigned the dummy value directly.

[the test case is abstruct_typeclass.m]

Index: compiler/erl_call_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/erl_call_gen.m,v
retrieving revision 1.13
diff -u -r1.13 erl_call_gen.m
--- compiler/erl_call_gen.m	17 Aug 2007 02:08:38 -0000	1.13
+++ compiler/erl_call_gen.m	24 Aug 2007 05:00:21 -0000
@@ -379,8 +379,9 @@
         ( is_dummy_argument_type(ModuleInfo, DestType) ->
             Statement = expr_or_void(MaybeSuccessExpr)
         ;
-            % XXX this doesn't do anything yet
-            Assign = elds_eq(expr_from_var(DestVar), expr_from_var(SrcVar)),
+            erl_gen_info_get_var_types(!.Info, VarTypes),
+            SrcVarExpr = var_to_expr_or_false(ModuleInfo, VarTypes, SrcVar),
+            Assign = elds_eq(expr_from_var(DestVar), SrcVarExpr),
             Statement = maybe_join_exprs(Assign, MaybeSuccessExpr)
         )
     ;
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list