Files
mercury/tests/invalid/test_nested.err_exp
Julien Fischer 835d8315ef Do not allow discriminated unions with a single zero-arity constructor to have
Estimated hours taken: 10
Branches: main, release

Do not allow discriminated unions with a single zero-arity constructor to have
user-defined equality or comparison.  Defining such types causes an assertion
failure in the compiler because the types are considered to be dummy types and
the runtime currently doesn't support (and probably won't ever) d.u. dummy
types with user-defined equality or comparison.

Fix another bug where the compiler was not printing out the `recompile with
-E' prompt at the appropriate time.  The bug was caused by the fact that there
were several copies of the globals structure and the one that was being
checked at the time the prompt was being printed out was not the one that had
been updated during the rest of compilation.

compiler/add_types.m:
	Emit an error message if an attempt is made to define a d.u.  dummy
	type with user-defined equality or comparison.

compiler/globals.m:
	Remove the extra_error_info field from the globals structure and turn
	it into a mutable.  Export access predicates for this mutable.  The
	reason for doing this is that the compiler was sometimes looking at
	the wrong copy of the globals structure when checking the value of
	this flag - this meant that sometimes the recompile with `-E' prompt
	was not being displayed.  Turning this flag into a mutable avoids the
	problem because now there is only one copy.

compiler/make_hlds.m:
	s/__/./  in a few spots.

doc/reference_manual.texi:
	Mention the new restrictions on discriminated union types with
	user-defined equality or comparison.

tests/invalid/exported_unify2.m:
tests/invalid/exported_unify3.m:
	Change some types with user-defined equality or comparison so that
	they are no longer dummy types.  These test cases have not been
	triggering the assertion failure in the compiler because they are only
	error checked and the assertion that is failing occurs further along
	in the compilation process.

tests/invalid/user_eq_dummy.{m,err_exp}:
	Test the new error message for dummy types with user-defined equality
	or comparison.

tests/invalid/extra_info_prompt.{m,err_exp}:
	Test that the recompile with `-E' prompt is being displayed when it
	should.

tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
	Include the new test cases.

	Where there is a verbose version of the error message compile with
	`-E'.

tests/recompilation/add_type_re.err_exp.2:
tests/invalid/*.err_exp:
	Update expected outputs to conform to the above.
2006-06-14 08:15:01 +00:00

26 lines
1.6 KiB
Plaintext

test_nested.m:009: In module `test_nested':
test_nested.m:009: error in `use_module' declaration:
test_nested.m:009: module `parent.private_child' is inaccessible.
test_nested.m:009: Either there was no prior `import_module' or `use_module'
test_nested.m:009: declaration to import module `parent', or the interface
test_nested.m:009: for module `parent' does not contain an `include_module'
test_nested.m:009: declaration for module `private_child'.
test_nested.m:010: In module `test_nested':
test_nested.m:010: error in `use_module' declaration:
test_nested.m:010: module `parent.undeclared_child' is inaccessible.
test_nested.m:010: Either there was no prior `import_module' or `use_module'
test_nested.m:010: declaration to import module `parent', or the interface
test_nested.m:010: for module `parent' does not contain an `include_module'
test_nested.m:010: declaration for module `undeclared_child'.
test_nested.m:013: In module `test_nested':
test_nested.m:013: error in `use_module' declaration:
test_nested.m:013: module `parent2.child' is inaccessible.
test_nested.m:013: Either there was no prior `import_module' or `use_module'
test_nested.m:013: declaration to import module `parent2', or the interface
test_nested.m:013: for module `parent2' does not contain an `include_module'
test_nested.m:013: declaration for module `child'.
test_nested.m:015: In definition of type `test_nested.foo'/0:
test_nested.m:015: error: undefined type `parent.nonexistent_child.foo'/0.
test_nested.m:015: (The module `parent.nonexistent_child' has not been
test_nested.m:015: imported.)