Move further to using error_spec lists instead of flags. compiler/module_qual.mq_info.m: Change mq_info type, used by all module qualification code, so that - instead of recording just the identities of used but undefined types, insts, modes and type classes, we record next to each id the error_spec(s) that we have used to report them, *provided* that the error is blocking progress to later compiler passes that expect all type, inst, mode and type class definitions to be fine (this applies to almost all of references to undefined entities), while - if the error is NOT blocking, because it occurs in a foreign_export enum, then we record its error_spec in a new field. As a result of this, code that does module qualification no longer has to pass around both an mq_info *and* a list of error_specs, because all of those error_specs are now stored in the mq_info. Change terminology from "maybe_suppress_found_undef" to "is the reference to an undefined entity blocking or nonblocking", because it expresses the distinction we are trying to make much more directly. compiler/module_qual.id_set.m: When recording that a type, inst, mode or type class reference is undefined, require the caller to suplly the error_spec generated for this error, for inclusion in the update mq_info structure. compiler/module_qual.qualify_items.m: Delete from module_qualify_aug_comp_unit's argument list the arguments that the caller can get on its own from the returned mq_info. Stop passing around lists of error_specs, as the mq_info now holds all error_specs related to module qualification. Associate each warning about an unused interface import with the name of the module. compiler/module_qual.qual_errors.m: compiler/make_hlds_error.m: For errors that we can put into the undef_{type,inst,mode,typeclass} fields of the mq_info, make the predicates and functions return the error_spec itself, instead of adding it to a list of error_specs. Change the interface of warn_unused_interface_import to allow its caller to also associate an error_spec with each such import. compiler/hlds_data.m: When we record that the definition of a type has an error, record one of the error_specs for it. This makes trivial the correctness argument of any later code that omits generating another error for the definition of the same type. compiler/add_mode.m: compiler/add_type.m: compiler/make_hlds_passes.m: Instead of setting flags for invalid type, inst or more definitions, use separate lists of error_specs for - invalid type definitions (in add_type.m) - invalid inst or mode definitions (in add_mode.m) - and for every other error_spec. In most places, we need to pass around only one error_spec list, because all the error_specs we can generate fall into the same category. compiler/mercury_compile_make_hlds.m: We used to test for the absence of undefined type and inst/mode errors - using data derived from the mq_info when module qualification ends, - and ALSO using data derived from the mq_info after we have added the augmented compilation unit's contents to the HLDS. Since the latter uses the same mq_info, just with more info added to it (while adding e.g. types and modes to the HLDS), the former is redundant. Delete it. Change the second test to test a list of error_specs instead of a flag. Add markers where further improvements are needed. compiler/make_hlds_types.m: Delete no longer needed types. compiler/add_class.m: compiler/add_clause.m: compiler/add_pragma_impl.m: compiler/add_pragma_type_spec.m: compiler/add_pred.m: compiler/qual_info.m: compiler/superhomogeneous_lambda.m: Conform to the changes above.