diff: polymorphic abstract exported eqv types error
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jan 28 02:02:53 AEDT 1998
Estimated hours taken: 1
compiler/make_hlds.m:
Print out a "Sorry, not implemented" message for
abstract exported polymorphic equivalence types
whose bodies have fewer type variables than their
heads. (Previously the compiler allow this,
but generated code that dumped core.)
Index: make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.255
diff -u -u -r1.255 make_hlds.m
--- make_hlds.m 1998/01/25 07:47:04 1.255
+++ make_hlds.m 1998/01/27 15:01:32
@@ -936,6 +936,40 @@
"Warning: undiscriminated union types (`+') not implemented.\n"),
io__set_output_stream(OldStream, _)
;
+ % XXX we can't handle abstract exported
+ % polymorphic equivalence types with monomorphic
+ % bodies, because the compiler stuffs up the
+ % type_info handling -- the caller passes type_infos,
+ % but the callee expects no type_infos
+ { Body = eqv_type(EqvType) },
+ { Status = abstract_exported },
+ { term__contains_var_list(Args, Var) },
+ { \+ term__contains_var(EqvType, Var) }
+ ->
+ io__stderr_stream(StdErr),
+ io__set_output_stream(StdErr, OldStream),
+ prog_out__write_context(Context),
+ io__write_string(
+ "Sorry, not implemented: polymorphic equivalence type,\n"),
+ prog_out__write_context(Context),
+ io__write_string(
+ " with monomorphic definition, exported as abstract type.\n"),
+ globals__io_lookup_bool_option(verbose_errors,
+ VerboseErrors),
+ ( { VerboseErrors = yes } ->
+ io__write_strings([
+ "\tA quick work-around is just export the type as a concrete type,\n",
+ "\tby putting the type definition in the interface section.\n",
+ "\tA better work-around is to use a \"wrapper\" type, with just one\n",
+ "\tfunctor that has just one arg, instead of an equivalence type.\n",
+ "\t(There's no performance penalty for this -- the compiler will\n",
+ "\toptimize the wrapper away.)\n"])
+ ;
+ []
+ ),
+ io__set_exit_status(1),
+ io__set_output_stream(OldStream, _)
+ ;
[]
)
).
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list