[m-dev.] for review: record syntax [2]

Simon Taylor stayl at cs.mu.OZ.AU
Thu Jan 13 14:30:34 AEDT 2000


> > > What I'm questioning is the value to the user of this enforcement
> > > relative to the complication of having to explain it.  On one hand,
> > > you're giving the user a nice convention, but on the other hand you're
> > > complicating the system and its explanation.  Since the user can quite
> > > easily either use a different field name, or no name and use pattern
> > > matching (the old-fashioned way) to define his setter, it seems to me
> > > this feature doesn't bring enough benefit to the user to warrant the
> > > confusion.

> I haven't had time to review Simon's changes in detail,
> so perhaps I shouldn't even comment at this stage,
> but at first glance I'm inclined to agree with Peter Schachte
> on this point.


OK, I've removed the mechanism for overriding the default
definition for field access functions. I'll commit this
later today if noone complains.


--- hlds_pred.m	2000/01/10 23:37:28	1.2
+++ hlds_pred.m	2000/01/12 01:22:31
@@ -2179,23 +2179,24 @@
 :- pred field_update_function_args(list(prog_var), prog_var, prog_var).
 :- mode field_update_function_args(in, out, out) is det.
 
-	% field_access_function_name(AccessType, FieldName,
-	%	IsBuiltin, FuncName).
+	% field_access_function_name(AccessType, FieldName, FuncName).
 	%
 	% From the access type and the name of the field,
 	% construct a function name.
-:- pred field_access_function_name(field_access_type, ctor_field_name,
-		field_access_function_is_builtin, sym_name).
-:- mode field_access_function_name(in, in, in, out) is det.
+:- pred field_access_function_name(field_access_type,
+		ctor_field_name, sym_name).
+:- mode field_access_function_name(in, in, out) is det.
 
-	% is_field_access_function_name(ModuleInfo, FuncName, AccessType,
-	%	IsBuiltin, FieldName).
+	% is_field_access_function_name(ModuleInfo, FuncName, Arity,
+	%	AccessType, FieldName).
 	%
 	% Inverse of the above.
 :- pred is_field_access_function_name(module_info, sym_name, arity,
-		field_access_type, field_access_function_is_builtin,
-		ctor_field_name).
-:- mode is_field_access_function_name(in, in, out, out, out, out) is semidet.
+		field_access_type, ctor_field_name).
+:- mode is_field_access_function_name(in, in, out, out, out) is semidet.
+
+:- pred pred_info_is_field_access_function(module_info, pred_info).
+:- mode pred_info_is_field_access_function(in, in) is semidet.
 
 :- implementation.
 
@@ -2214,31 +2215,12 @@
 		error("field_update_function_args")
 	).
 
-field_access_function_name(AccessType, FieldName, Builtin, FuncName) :-
-	(
-		AccessType = set,
-		add_sym_name_suffix(FieldName, ":=", FuncName0)
-	;
-		AccessType = get,
-		FuncName0 = FieldName
-	),
-	(
-		Builtin = builtin_field_access,
-		remove_sym_name_prefix(FuncName, "builtin ", FuncName0)
-	;
-		Builtin = non_builtin_field_access,
-		FuncName = FuncName0
-	).
+field_access_function_name(get, FieldName, FieldName).
+field_access_function_name(set, FieldName, FuncName) :-
+	add_sym_name_suffix(FieldName, ":=", FuncName).
 
-is_field_access_function_name(ModuleInfo, FuncName0, Arity,
-		AccessType, Builtin, FieldName) :-
-	( remove_sym_name_prefix(FuncName0, "builtin ", FuncName1) ->
-		FuncName = FuncName1,
-		Builtin = builtin_field_access
-	;
-		FuncName = FuncName0,
-		Builtin = non_builtin_field_access
-	),
+is_field_access_function_name(ModuleInfo, FuncName, Arity,
+		AccessType, FieldName) :-
 	( remove_sym_name_suffix(FuncName, ":=", FieldName0) ->
 		Arity = 2,
 		AccessType = set,
@@ -2250,6 +2232,15 @@
 	),
 	module_info_ctor_field_table(ModuleInfo, CtorFieldTable),
 	map__contains(CtorFieldTable, FieldName).
+
+pred_info_is_field_access_function(ModuleInfo, PredInfo) :-
+	pred_info_get_is_pred_or_func(PredInfo, function),
+	pred_info_module(PredInfo, Module),
+	pred_info_name(PredInfo, Name),
+	pred_info_arity(PredInfo, PredArity),
+	adjust_func_arity(function, FuncArity, PredArity),
+	is_field_access_function_name(ModuleInfo, qualified(Module, Name),
+		FuncArity, _, _).
 
 %-----------------------------------------------------------------------------%
 
--- make_hlds.m	2000/01/10 23:37:09	1.4
+++ make_hlds.m	2000/01/13 00:43:38
@@ -2628,36 +2628,26 @@
 		Status, Context, Module) -->
 	(
 		{ is_field_access_function_name(Module, FuncName, FuncArity,
-			AccessType, IsBuiltin, FieldName) }
+			AccessType, FieldName) }
 	->
-		check_field_access_function(AccessType, IsBuiltin,
-			FieldName, FuncName, FuncArity, Status,
-			Context, Module)
+		check_field_access_function(AccessType, FieldName, FuncName,
+			FuncArity, Status, Context, Module)
 	;
 		[]
 	).
 	
 :- pred check_field_access_function(field_access_type,
-		field_access_function_is_builtin, ctor_field_name, sym_name,
+		ctor_field_name, sym_name,
 		arity, import_status, prog_context, module_info,
 		io__state, io__state).
-:- mode check_field_access_function(in, in, in, in, in, in, in, in,
+:- mode check_field_access_function(in, in, in, in, in, in, in,
 		di, uo) is det.
 		
-check_field_access_function(_AccessType, IsBuiltin, FieldName,
-		FuncName, FuncArity, FuncStatus, Context, Module, IO0, IO) :-
+check_field_access_function(_AccessType, FieldName, FuncName, FuncArity,
+		FuncStatus, Context, Module, IO0, IO) :-
 	adjust_func_arity(function, FuncArity, PredArity),
 	FuncCallId = function - FuncName/PredArity,
 
-	(
-		IsBuiltin = builtin_field_access,
-		report_error_redefine_builtin_field_access_function(Context,
-			FuncCallId, IO0, IO1)
-	;
-		IsBuiltin = non_builtin_field_access,
-		IO1 = IO0
-	),
-
 	%
 	% Check that a function applied to an exported type
 	% is also exported.
@@ -2672,9 +2662,9 @@
 		DefnStatus = exported, FuncStatus \= exported
 	->
 		report_field_status_mismatch(Context,
-			FuncCallId, IO1, IO)
+			FuncCallId, IO0, IO)
 	;
-		IO = IO1
+		IO = IO0
 	).
 
 :- pred report_field_status_mismatch(prog_context, simple_call_id,
@@ -2693,21 +2683,6 @@
 	error_util__write_error_pieces(Context, 0, ErrorPieces),
 	io__set_exit_status(1).
 
-:- pred report_error_redefine_builtin_field_access_function(prog_context,
-		simple_call_id, io__state, io__state).
-:- mode report_error_redefine_builtin_field_access_function(in,
-		in, di, uo) is det.
-
-report_error_redefine_builtin_field_access_function(Context, CallId) -->
-	{ hlds_out__simple_call_id_to_string(CallId, CallIdString) },
-	{ ErrorPieces = [
-		words("Error: redefinition of builtin field access"),
-		fixed(CallIdString),
-		words(".")
-	] },
-	error_util__write_error_pieces(Context, 0, ErrorPieces),
-	io__set_exit_status(1).
-
 %-----------------------------------------------------------------------------%
 
 :- pred add_builtin(pred_id, list(type), pred_info, pred_info).
@@ -3236,6 +3211,52 @@
 		io__write_string("  with `:- pragma c_code' declaration preceding.\n"),
 		{ Info = Info0 }
 	;
+		%
+		% User-supplied clauses for field access functions are
+		% not allowed -- the clauses are always generated by the
+		% compiler.
+		%
+		{ PredOrFunc = function },	
+		{ adjust_func_arity(function, FuncArity, Arity) },
+		{ is_field_access_function_name(ModuleInfo1, PredName,
+			FuncArity, _, _) },
+
+		% Don't report errors for clauses for field access
+		% function clauses in `.opt' files.
+		{ Status \= opt_imported }
+	->
+		{ Info = Info0 },
+		{ module_info_incr_errors(ModuleInfo1, ModuleInfo) },
+		{ hlds_out__simple_call_id_to_string(
+			PredOrFunc - PredName/Arity, CallIdString0) },
+		{ string__append(CallIdString0, ".", CallIdString) },
+		{ ErrorPieces0 = [
+			words("Error: clause for automatically generated"),
+			words("field access"),
+			fixed(CallIdString),
+			nl
+		] },
+		globals__io_lookup_bool_option(verbose_errors, Verbose),
+		(
+			{ Verbose = yes },
+			{ ErrorPieces1 = [
+				words("Clauses for field access functions"),
+				words("are automatically generated by the"),
+				words("compiler. To supply your own"),
+				words("definition for a field access"),
+				words("function, for example to check"),
+				words("the input to a field update,"),
+				words("give the field of the constructor a"),
+				words("different name.")
+			] },
+			{ list__append(ErrorPieces0, ErrorPieces1,
+				ErrorPieces) }
+		;
+			{ Verbose = no },
+			{ ErrorPieces = ErrorPieces0 }
+		),
+		error_util__write_error_pieces(Context, 0, ErrorPieces)
+	;
 		% Ignore clauses for builtins. This makes bootstrapping
 		% easier when redefining builtins to use normal Mercury code.
 		{ code_util__predinfo_is_builtin(PredInfo1) }
@@ -5413,8 +5434,7 @@
 construct_field_access_function_call(AccessType, Context,
 		MainContext, SubContext, FieldName, RetArg, Args,
 		Functor, Goal) :-
-	field_access_function_name(AccessType, FieldName,
-		non_builtin_field_access, FuncName),
+	field_access_function_name(AccessType, FieldName, FuncName),
 	list__length(Args, Arity),
 	Functor = cons(FuncName, Arity),
 	create_atomic_unification(RetArg, functor(Functor, Args),
--- post_typecheck.m	2000/01/10 23:37:09	1.3
+++ post_typecheck.m	2000/01/12 01:15:41
@@ -816,6 +816,13 @@
 		%
 		\+ code_util__compiler_generated(PredInfo0),
 
+		%
+		% We don't do this for the clause introduced by the
+		% compiler for a field access function -- that needs
+		% to be expanded into unifications below.
+		%
+		\+ pred_info_is_field_access_function(ModuleInfo0, PredInfo0),
+
 		module_info_get_predicate_table(ModuleInfo0, PredTable),
 		predicate_table_search_func_sym_arity(PredTable,
 			PredName, Arity, PredIds),
@@ -846,14 +853,13 @@
 		Goal = FuncCall - GoalInfo0
 	;
 		%
-		% Is it a call to a field access function for
-		% which the user has not provided a definition.
-		% This test must be after conversion of function
+		% Is it a call to an automatically generated field access
+		% function. This test must be after conversion of function
 		% calls into predicate calls above.
 		%
 		ConsId0 = cons(Name, Arity),
 		is_field_access_function_name(ModuleInfo0, Name, Arity,
-			AccessType, _IsBuiltin, FieldName)
+			AccessType, FieldName)
 	->
 		post_typecheck__finish_field_access_function(ModuleInfo0,
 			PredInfo0, PredInfo, AccessType, FieldName,
--- typecheck.m	2000/01/10 23:37:09	1.3
+++ typecheck.m	2000/01/12 01:19:10
@@ -327,7 +327,7 @@
 	    Changed = no,
 	    IOState = IOState0
 	;
-	    maybe_add_default_field_access_clauses(ModuleInfo,
+	    maybe_add_field_access_function_clause(ModuleInfo,
 		    PredInfo0, PredInfo1),
 	    pred_info_arg_types(PredInfo1, _ArgTypeVarSet, ExistQVars0,
 		    ArgTypes0),
@@ -735,37 +735,34 @@
 	%
 	% For a field access function for which the user has supplied
 	% a declaration but no clauses, add a clause
-	% 'foo:='(X, Y) = 'builtin foo:='(X, Y).
+	% 'foo:='(X, Y) = 'foo:='(X, Y).
+	% As for the default clauses added for builtins, this is not a
+	% recursive call -- post_typecheck.m will expand the body into
+	% unifications.
 	%
-:- pred maybe_add_default_field_access_clauses(module_info,
+:- pred maybe_add_field_access_function_clause(module_info,
 		pred_info, pred_info).
-:- mode maybe_add_default_field_access_clauses(in, in, out) is det.
+:- mode maybe_add_field_access_function_clause(in, in, out) is det.
 
-maybe_add_default_field_access_clauses(ModuleInfo, PredInfo0, PredInfo) :-
-	pred_info_module(PredInfo0, FuncModule),
-	pred_info_name(PredInfo0, FuncName),
-	pred_info_arity(PredInfo0, PredArity),
-	pred_info_get_is_pred_or_func(PredInfo0, PredOrFunc),
+maybe_add_field_access_function_clause(ModuleInfo, PredInfo0, PredInfo) :-
 	pred_info_import_status(PredInfo0, ImportStatus),
-	FuncSymName = qualified(FuncModule, FuncName),
 	pred_info_clauses_info(PredInfo0, ClausesInfo0),
 	clauses_info_clauses(ClausesInfo0, Clauses0),
 	(
-		PredOrFunc = function,
+		pred_info_is_field_access_function(ModuleInfo, PredInfo0),
 		Clauses0 = [],
-		status_defined_in_this_module(ImportStatus, yes),
-		adjust_func_arity(function, FuncArity, PredArity),
-		is_field_access_function_name(ModuleInfo, FuncSymName,
-			FuncArity, AccessType, non_builtin_field_access,
-			FieldName)
+		status_defined_in_this_module(ImportStatus, yes)
 	->
-		field_access_function_name(AccessType, FieldName,
-			builtin_field_access, BuiltinFuncName),
 		clauses_info_headvars(ClausesInfo0, HeadVars),
 		pred_args_to_func_args(HeadVars, FuncArgs, FuncRetVal),
 		pred_info_context(PredInfo0, Context),
+		pred_info_module(PredInfo0, FuncModule),
+		pred_info_name(PredInfo0, FuncName),
+		pred_info_arity(PredInfo0, PredArity),
+		adjust_func_arity(function, FuncArity, PredArity),
+		FuncSymName = qualified(FuncModule, FuncName),
 		create_atomic_unification(FuncRetVal,
-			functor(cons(BuiltinFuncName, FuncArity), FuncArgs),
+			functor(cons(FuncSymName, FuncArity), FuncArgs),
 			Context, explicit, [], Goal0),
 		Goal0 = GoalExpr - GoalInfo0,
 		set__list_to_set(HeadVars, NonLocals),
@@ -2829,14 +2826,14 @@
 	Functor = cons(Name, Arity),
 	typecheck_info_get_module_info(TypeCheckInfo, ModuleInfo),
 	is_field_access_function_name(ModuleInfo, Name, Arity,
-		AccessType, IsBuiltin, FieldName),
+		AccessType, FieldName),
 
 	module_info_ctor_field_table(ModuleInfo, CtorFieldTable),
 	map__search(CtorFieldTable, FieldName, FieldDefns),
 	
 	list__filter_map(
 		make_field_access_function_cons_type_info(TypeCheckInfo, Name,
-			Arity, AccessType, IsBuiltin, FieldName),
+			Arity, AccessType, FieldName),
 		FieldDefns, MaybeConsTypeInfos),
 
 	list__filter_map(
@@ -2851,26 +2848,24 @@
 
 :- pred make_field_access_function_cons_type_info(typecheck_info,
 		sym_name, arity, field_access_type,
-		field_access_function_is_builtin,
 		ctor_field_name, hlds_ctor_field_defn, maybe_cons_type_info).
 :- mode make_field_access_function_cons_type_info(in,
-		in, in, in, in, in, in, out) is semidet.
+		in, in, in, in, in, out) is semidet.
 
 make_field_access_function_cons_type_info(TypeCheckInfo, FuncName, Arity,
-		AccessType, IsBuiltin, FieldName, FieldDefn, ConsTypeInfo) :-
+		AccessType, FieldName, FieldDefn, ConsTypeInfo) :-
 	get_field_access_constructor(TypeCheckInfo, FuncName, Arity,
-		AccessType, IsBuiltin, FieldDefn, FunctorConsTypeInfo),
+		AccessType, FieldDefn, FunctorConsTypeInfo),
 	convert_field_access_cons_type_info(AccessType, FieldName, FieldDefn,
 		FunctorConsTypeInfo, ConsTypeInfo).
 
 :- pred get_field_access_constructor(typecheck_info, sym_name, arity,
-		field_access_type, field_access_function_is_builtin,
-		hlds_ctor_field_defn, cons_type_info).
+		field_access_type, hlds_ctor_field_defn, cons_type_info).
 :- mode get_field_access_constructor(typecheck_info_ui,
-		in, in, in, in, in, out) is semidet.
+		in, in, in, in, out) is semidet.
 
 get_field_access_constructor(TypeCheckInfo, FuncName, Arity, _AccessType,
-		IsBuiltin, FieldDefn, FunctorConsTypeInfo) :-
+		FieldDefn, FunctorConsTypeInfo) :-
 
 	FieldDefn = hlds_ctor_field_defn(_, _, TypeId, ConsId, _),
 	TypeId = qualified(TypeModule, _) - _,
@@ -2886,21 +2881,6 @@
 	\+ predicate_table_search_func_m_n_a(PredTable, TypeModule,
 		UnqualFuncName, Arity, _),
 
-	%
-	% Only allow calls to the `'builtin <field>'/1' and
-	% `'builtin field:='/2' functions from within the same module
-	% as the type definition.
-	%
-	(
-		IsBuiltin = builtin_field_access,
-		typecheck_info_get_predid(TypeCheckInfo, PredId),
-		module_info_pred_info(ModuleInfo, PredId, PredInfo),
-		pred_info_module(PredInfo, PredModule),
-		PredModule = TypeModule
-	;
-		IsBuiltin = non_builtin_field_access
-	),
-	
 	module_info_ctors(ModuleInfo, Ctors),
 	map__lookup(Ctors, ConsId, ConsDefns0),
 	list__filter(


--- reference_manual.texi	2000/01/10 00:19:38	1.6
+++ reference_manual.texi	2000/01/13 03:21:39
@@ -1320,7 +1320,7 @@
 @menu
 * Field selection::
 * Field update::
-* Overriding field access functions::
+* User-supplied field access function declarations::
 * Field access examples::
 @end menu
 
@@ -1368,6 +1368,9 @@
 By default, this function has no declared modes --- the modes
 are inferred at each call to the function.
 
+An explicit lambda expression must be used to create a higher-order term
+from a field update function, unless a mode declaration is supplied.
+
 Some fields cannot be updated using field update functions.
 For the constructor @samp{unsettable/2} below, neither field may be updated
 because the resulting term would not be well-typed. A future release
@@ -1382,80 +1385,76 @@
         ).
 @end example
 
-An explicit lambda expression must be used to create a higher-order term
-from a field update function, unless a mode declaration is supplied.
+ at node User-supplied field access function declarations
+ at subsection User-supplied field access function declarations
 
- at node Overriding field access functions
- at subsection Overriding field access functions
+Type and mode declarations for compiler-generated field access functions
+for fields of constructors local to a module may be placed in the interface
+section of the module. This allows the implementation of a type to be hidden
+while still allowing client modules to use record syntax to manipulate values
+of the type. Supplying a single mode declaration also allows higher-order
+terms to be created from a field access function without using explicit
+lambda expressions.
+
+Declarations for field access functions for fields occurring in the interface
+section of a module must also occur in the interface section.
 
-Users can provide declarations and clauses for field access
-functions @samp{@var{field}/1} and @samp{'@var{field}:='/2},
-overriding the compiler-generated default declarations and
-clauses.
-
-The compiler-generated field access functions can always
-be called using the functions @samp{'builtin @var{field}'/1} and
- at samp{'builtin @var{field}:='/2}. These functions may not be overridden
-by the user. They are visible only in the module containing the declaration
-of the type containing the field --- client modules must always use the
-user-supplied field access functions.
-
-Declarations for user-supplied field access functions for fields occurring
-in the interface section of a module must also occur in the interface section.
-
-Declarations for field access functions for fields local
-to a module may be placed in the interface section of the module. This allows
-the implementation of a type to be hidden while still allowing
-client modules to use record syntax to manipulate values of the type.
-Clauses need not be supplied for such functions --- the compiler adds
-a default clause containing a call to the corresponding builtin
-field access function.
-
-Declarations of field access functions can also be supplied for fields
-which are not a part of any type. This is useful when the data structures of
-a program change so that a value which was previously stored as part
-of a type is now computed each time it is requested. It also
+Declarations and clauses for field access functions can also be supplied
+for fields which are not a part of any type. This is useful when the data
+structures of a program change so that a value which was previously stored
+as part of a type is now computed each time it is requested. It also
 allows record syntax to be used for type class methods.
 
 @node Field access examples
 @subsection Field access examples
 
-The type declaration
+The examples make use of the following type declarations:
+
 @example
 :- type type1
         ---> type1(
-                field1 :: int,
+                field1 :: type2,
                 field2 :: string
         ).
+
+:- type type2
+        ---> type2(
+                field3 :: int,
+                field4 :: int
+        ).
+
 @end example
-causes the following functions to be automatically defined by the compiler:
+
+The compiler generates some field access functions for @samp{field1}.
+The functions generated for the other fields are similar.
+
 @example
-:- func field1(type1) = int.
+:- func field1(type1) = type2.
 field1(type1(Field1, _)) = Field1.
 
-:- func 'field1:='(type1, int) = type1.
+:- func 'field1:='(type1, type2) = type1.
 'field1:='(type1(_, Field2), Field1) = type1(Field1, Field2).
+ at end example
+
+Using these functions and the syntactic sugar described in
+ at ref{Record syntax}, programmers can write code such as
 
-:- func field2(type1) = string.
-field2(type1(_, Field2)) = Field2.
+ at example
+:- func increment_field3(type1) = type1.
 
-:- func 'field2:='(type1, string) = type1.
-'field2:='(type1(Field1, _), Field2) = type1(Field1, Field2).
+increment_field3(Term0) =
+        Term0^field1^field3 := Term0^field1^field3 + 1.
 @end example
 
-The programmer can add a restriction on the domain of
- at samp{field1} (checked at runtime), by overriding the
-update function for @samp{field1}:
+The compiler expands this into
 
 @example
-:- func 'field1:='(type1, int) = type1.
+incremental_field3(Term0) = Term :-
+        OldField3 = field3(field1(Term0)),
 
-'field1:='(Term, Field1) = 'builtin field1:='(Term, Field1) :-
-        ( Field1 < 0 ->
-                error("'field1:=': negative value for field1")
-        ;
-                true
-        ).
+        OldField1 = field1(Term0),
+        NewField1 = 'field3:='(OldField1, OldField3 + 1),
+        Term = 'field1:='(Term0, NewField1).
 @end example
 
 @node Modes

--- record_syntax_errors.m	2000/01/13 01:00:53	1.2
+++ record_syntax_errors.m	2000/01/13 01:00:56
@@ -53,5 +53,6 @@
 % for exported fields.
 :- func field4(cons) = int.
 
-:- func 'builtin field4'(cons) = int.
-'builtin field4'(cons(_, _, _)) = 1.
+% Check error message for clauses for automatically generated access functions.
+field4(_) = 1.
+
--- record_syntax_errors.err_exp	2000/01/13 00:59:50	1.2
+++ record_syntax_errors.err_exp	2000/01/13 01:02:19
@@ -9,13 +9,14 @@
 record_syntax_errors.m:054:   function `record_syntax_errors:field4/1':
 record_syntax_errors.m:054:   error: a field access function for an exported
 record_syntax_errors.m:054:   field must also be exported.
-record_syntax_errors.m:056: Error: redefinition of builtin field access
-record_syntax_errors.m:056:   function `record_syntax_errors:builtin field4/1'
-record_syntax_errors.m:056:   .
-record_syntax_errors.m:056: In declaration of
-record_syntax_errors.m:056:   function `record_syntax_errors:builtin field4/1':
-record_syntax_errors.m:056:   error: a field access function for an exported
-record_syntax_errors.m:056:   field must also be exported.
+record_syntax_errors.m:057: Error: clause for automatically generated field
+record_syntax_errors.m:057:   access function `record_syntax_errors:field4/1'.
+record_syntax_errors.m:057:   Clauses for field access functions are
+record_syntax_errors.m:057:   automatically generated by the compiler. To
+record_syntax_errors.m:057:   supply your own definition for a field access
+record_syntax_errors.m:057:   function, for example to check the input to a
+record_syntax_errors.m:057:   field update, give the field of the constructor a
+record_syntax_errors.m:057:   different name.
 record_syntax_errors.m:014: Error: no clauses for predicate `record_syntax_errors:dcg_syntax/2'.
 record_syntax_errors.m:016: Error: no clauses for predicate `record_syntax_errors:dcg_syntax_2/2'.
 record_syntax_errors.m:042: In clause for predicate `record_syntax_errors:construct_exist_cons/1':
@@ -30,6 +31,19 @@
 record_syntax_errors.m:046:   and constant `"invalid value"'.
 record_syntax_errors.m:046:   argument has type `int',
 record_syntax_errors.m:046:   constant `"invalid value"' has type `string'.
+	The partial type assignment was:
+	HeadVar__1 :: (record_syntax_errors:cons)
+	Cons :: (record_syntax_errors:cons)
+	Cons0 :: (record_syntax_errors:cons)
+	V_4 :: int
+	V_5 :: (record_syntax_errors:cons2)
+	V_6 :: (record_syntax_errors:cons2)
+	V_7 :: int
+	V_8 :: int
+	V_9 :: (record_syntax_errors:cons2)
+	V_10 :: int
+	V_11 :: int
+
 record_syntax_errors.m:050: In clause for predicate `record_syntax_errors:term_type_error/1':
 record_syntax_errors.m:050:   in argument 2 of functor `field6:=/2':
 record_syntax_errors.m:050:   in unification of argument
@@ -37,4 +51,3 @@
 record_syntax_errors.m:050:   type error in argument(s) of functor `field4:=/2'.
 record_syntax_errors.m:050:   Argument 1 has type `(record_syntax_errors:cons2)',
 record_syntax_errors.m:050:   expected type was `(record_syntax_errors:cons)'.
-For more information, try recompiling with `-E'.
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.56
diff -u -u -r1.56 Mmakefile
--- Mmakefile	1999/12/27 11:07:33	1.56
+++ Mmakefile	2000/01/13 00:58:47
@@ -52,6 +52,7 @@
 	prog_io_erroneous.m \
 	qual_basic_test2.m \
 	qualified_cons_id2.m \
+	record_syntax_errors.m \
 	some.m \
 	spurious_mode_error.m \
 	test_nested.m \
@@ -96,6 +97,7 @@
 MCFLAGS-multisoln_func	=	--infer-types
 MCFLAGS-no_exports = 		--halt-at-warn
 MCFLAGS-sub_c = 		--verbose-error-messages
+MCFLAGS-record_syntax_errors =	--verbose-error-messages
 
 # The bug is caught when generating dependencies, so it is
 # easiest just to do that step.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list