2024-11-21 21:03 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000563mercuryBugpublic2023-09-04 15:05
Reporterwangp 
Assigned Tozs 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000563: type constructor for equivalence type not found
DescriptionThe compiler throws an exception when compiling the attached test case in hlc (and probably other MLDS grades).

quirks.m defines an equivalence type in the implementation which uses a type constructor that it imports:
    :- import_module set.
    :- type quirks == set(string).

But when generating code for a module that imports quirks.m, that type constructor is not found.

% mmake GRADE=hlc.gc getprop.depend
% mmake GRADE=hlc.gc getprop.c
% cat getprop.err
Uncaught Mercury exception:
Software Error: map.lookup: key not found
        Key Type: string
        Key Value: "set"
        Value Type: tree234.tree234(parse_tree.prog_data.type_ctor, hlds.hlds_data.hlds_type_defn)
Stack dump follows:
   0 pred exception.throw/1-0 (erroneous) (exception.m:313)
   1 pred require.error/1-0 (erroneous) (require.m:172)
   2 pred require.report_lookup_error/3-0 (erroneous) (require.m:276)
   3 pred map.lookup/3-0 (det) (map.m:1272)
   4 pred hlds.hlds_data.lookup_type_ctor_defn/3-0 (det) (hlds_data.m:598)
   5 func check_hlds.type_util.classify_type_ctor/2-0 (det) (type_util.m:1038)
   6 func ml_backend.mlds.mercury_type_to_mlds_type/2-0 (det) (mlds.m:2661)
   7 pred ml_backend.ml_code_util.ml_gen_local_var_decl/6-0 (det) (ml_code_util.m:998)
   8 pred ml_backend.ml_code_gen.ml_gen_local_var_decls/6-0 (det) (ml_code_gen.m:1392)
   9 pred ml_backend.ml_code_gen.ml_gen_goal/7-0 (det) (ml_code_gen.m:611)
  10 pred ml_backend.ml_proc_gen.ml_gen_proc_body/10-0 (det) (ml_proc_gen.m:1688)
  11 pred ml_backend.ml_proc_gen.ml_gen_proc/11-0 (det) (ml_proc_gen.m:620)
  12 pred list.foldl3/8-0 (det) (list.m:3556)
  13 pred ml_backend.ml_proc_gen.ml_gen_scc_code/10-0 (det) (ml_proc_gen.m:322)
  14 pred ml_backend.ml_proc_gen.ml_gen_scc/12-0 (det) (ml_proc_gen.m:227)
  15 pred ml_backend.ml_proc_gen.ml_gen_sccs/12-0 (det) (ml_proc_gen.m:211)
  16 pred ml_backend.ml_proc_gen.ml_gen_preds/9-0 (det) (ml_proc_gen.m:121)
  17 pred ml_backend.ml_top_gen.ml_code_gen/6-0 (det) (ml_top_gen.m:84)
  18 pred top_level.mercury_compile_mlds_back_end.mlds_backend/8-0 (det) (mercury_compile_mlds_back_end.m:128)
  19 pred top_level.mercury_compile_main.after_front_end_passes/13-0 (det) (mercury_compile_main.m:1930)
  20 pred top_level.mercury_compile_main.process_augmented_module/14-0 (det) (mercury_compile_main.m:1756)
  21 pred top_level.mercury_compile_main.augment_and_process_module/15-0 (det) (mercury_compile_main.m:1646)
  22 pred list.map_foldl3/9-0 (det) (list.m:3892)
  23 pred top_level.mercury_compile_main.augment_and_process_all_submodules/15-0 (det) (mercury_compile_main.m:1588)
  24 pred top_level.mercury_compile_main.read_augment_and_process_module_ok/13-0 (det) (mercury_compile_main.m:1420)
  25 pred top_level.mercury_compile_main.read_augment_and_process_module/11-0 (det) (mercury_compile_main.m:1362)
  26 pred top_level.mercury_compile_main.do_process_compiler_arg/10-0 (det) (mercury_compile_main.m:1138)
  27 pred top_level.mercury_compile_main.setup_and_process_compiler_arg/14-0 (det) (mercury_compile_main.m:1010)
  28 pred top_level.mercury_compile_main.setup_and_process_compiler_cmd_line_args/16-0 (det) (mercury_compile_main.m:929)
  29 pred top_level.mercury_compile_main.do_op_mode_args/13-0 (det) (mercury_compile_main.m:742)
  30 pred top_level.mercury_compile_main.do_op_mode/12-0 (det) (mercury_compile_main.m:577)
  31 pred top_level.mercury_compile_main.main_after_setup/7-0 (det) (mercury_compile_main.m:532)
  32 pred top_level.mercury_compile_main.real_main_after_expansion/3-0 (det) (mercury_compile_main.m:276)
  33 pred top_level.mercury_compile_main.real_main/2-0 (det) (mercury_compile_main.m:138)
  34 pred mercury_compile.main/2-0 (det) (mercury_compile.m:32)
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0001200

wangp (developer)

The regression was introduced in commit 45d6c5bde3d6df2cba786a2ab821b1ce3ebb86ff "The first step in reducing .int2 files to essentials.", which made this change to the .int2 file:

diff --git a/Mercury.good/int2s/quirks.int2 b/Mercury.bad/int2s/quirks.int2
index af739867c..2c5455d64 100644
--- a/Mercury.good/int2s/quirks.int2
+++ b/Mercury.bad/int2s/quirks.int2
@@ -2,5 +2,4 @@
 :- interface.
 :- type quirks.
 :- implementation.
-:- use_module set.
 :- type quirks == set.set(string).

~0001217

zs (developer)

Fix committed 2023 sep 4.
+Notes

-Issue History
Date Modified Username Field Change
2022-08-03 13:04 wangp New Issue
2022-08-03 13:04 wangp File Added: eqv-type-module-import-bug.tar.gz
2022-08-03 15:47 wangp Note Added: 0001200
2022-08-03 15:53 zs Assigned To => zs
2022-08-03 15:53 zs Status new => assigned
2023-09-04 15:05 zs Status assigned => resolved
2023-09-04 15:05 zs Resolution open => fixed
2023-09-04 15:05 zs Note Added: 0001217
+Issue History