[m-rev.] [PATCH] Fix writing of coerce casts in .opt files.
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Feb 16 17:20:08 AEDT 2022
2022-02-16 16:13 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:
> ;
> GenericCall = cast(CastType),
> - CastTypeString = cast_type_to_string(CastType),
> + ( if CastType = subtype_coerce then
> + % We must produce valid Mercury code for coerce casts that are
> + % written to .opt files.
> + CastTypeString = "coerce"
> + else
> + CastTypeString = cast_type_to_string(CastType)
> + ),
This should be a switch on CastType.
> --- /dev/null
> +++ b/tests/hard_coded/coerce_opt.exp
> @@ -0,0 +1,4 @@
> +coerce_opt_2.non_empty_list(int)
> +[1, 2, 3]
> +list.list(int)
> +[1, 2, 3]
Doesn't the source file print the list.list
*before* the non_empty_list? How come
the .exp file has them in the reverse order?
The rest is fine.
Thanks for that.
Zoltan.
More information about the reviews
mailing list