Files
mercury/tests/hard_coded/parent2.exp
Fergus Henderson 3c0063fac0 Add support for the use of partial module qualifiers,
Estimated hours taken: 8

Add support for the use of partial module qualifiers,
e.g. using `child:foo' to refer to `parent🧒foo'.
Previously we only allowed names to be fully-qualified
or completely unqualified.

Note that we still don't yet keep track of which modules are visible,
so this change does not properly handle the distinction between
`import_module' and `use_module' declarations for parent modules.
It basically assumes that `child:foo' is allowed iff plain `foo'
would be allowed (i.e. iff `parent:child' has been imported)
whereas it ought to be allowed iff `parent' has been imported.

compiler/modules.m:
	Add get_partial_qualifiers/2, for use by make_hlds.m
	and hlds_module.m.

compiler/make_hlds.m:
	Insert partially-qualified symbols into the cons_table.

compiler/hlds_module.m:
	Insert partially-qualified symbols into the pred_table.

compiler/module_qual.m:
	When searching the symbol tables used for types, insts, modes,
	and typeclasses, search for partially-qualified symbols.

compiler/modecheck_unify.m:
	When module-qualifying cons_ids, make sure that we fully module
	qualify them even if they're already partially qualified.

tests/hard_coded/parent.m:
tests/hard_coded/parent.child.m:
tests/hard_coded/parent.child2.m:
tests/hard_coded/parent.exp:
tests/hard_coded/parent2.m:
tests/hard_coded/parent2.child.m:
tests/hard_coded/parent2.exp:
	Uncomment the previously-failed test of using partially-qualified
	symbol names.  Add a new child module, `parent.child2', and import it
	using `use_module', so that we test `use_module' as well as
	`import_module'.  Add code to test importing of types and
	constructors.
1998-03-04 19:48:04 +00:00

11 lines
176 B
Plaintext

parent2:hello
parent2:hello
t1 = parent2:foo
t2 = parent2:foo
t3 = parent2:foo
t4 = parent2:foo
has_type_t1 = bar
has_type_t2 = bar
has_type_t3 = baz(42)
has_type_t4 = baz(42)