2024-12-15 07:13 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000521mercuryBugpublic2022-01-25 01:24
Reporterdirkz 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformMercury 20.06OSmacOS CatalinaOS Version10.15.7
Product Version 
Target VersionFixed in Version 
Summary0000521: Missing error message about an 'undefined type'; misleading error message instead
DescriptionThe compiler should clearly complain about an 'undefined type'.

Expected error message:
thing_def.m:17 error: undefined type `list'/1.

Actual error message:
main.m:033: In clause for predicate `get_wrapped_things'/1:
main.m:033: in argument 1 of functor `list_wrapper/1':
main.m:033: type error in unification of argument
main.m:033: and constant `get_things'.
main.m:033: argument has type `list.list(thing_def.thing)',
main.m:033: constant `get_things' has type `list(thing_def.thing)'.
For more information, recompile with `-E'.
Steps To Reproducemmc --make main
Additional InformationAttached example:

Module thing_def.m declares this function without importing the list module:

:- func get_things = list(thing).

Not importing the list module is the actual problem. But the compiler does not complain about the missing import. Instead it issues a misleading error message.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0001108

zs (developer)

I just added code to compiler to complain about the missing import. It should
be in the next ROTD. You still get the misleading error message, but you
also get a non-misleading pointer to where the error is.

The error should really be diagnosed when the compiler makes the interface file
for the module with the missing import. The compiler has had an option named
--print-errors-warnings-when-generating-interface for a while now which does
exactly that, but for now, it is not turned on by default, because it is part
of a bigger set of changes that are not complete yet. However, if you are willing to live with an experimental-for-now feature, you can enable it manually.

~0001111

dirkz (reporter)

Thank you for fixing the error message.

I just performed a successful test with rotd-2020-10-09 on MacOS High Sierra 10.13.6.

~0001159

zs (developer)

The compiler has been diagnosing such errors when making interface files
for some time now.
+Notes

-Issue History
Date Modified Username Field Change
2020-09-29 17:23 dirkz New Issue
2020-09-29 17:23 dirkz File Added: example.tgz
2020-10-08 16:04 zs Assigned To => zs
2020-10-08 16:04 zs Status new => assigned
2020-10-08 16:10 zs Note Added: 0001108
2020-10-12 05:15 dirkz Note Added: 0001111
2022-01-25 01:24 zs Status assigned => resolved
2022-01-25 01:24 zs Resolution open => fixed
2022-01-25 01:24 zs Note Added: 0001159
+Issue History