2023-01-28 22:07 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000162mercuryBugpublic2022-10-11 16:43
Reporterpbone 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000162: No compiler error for a mode involving an instantation state that doesn't match the argument type.
DescriptionIn the following code I expect to receive a compiler error telling me that the instantiation state that I'm trying to use is incorrect for the type that I'm using.

If the body of the predicate is more detailed and for example uses the empty list for the head variable then the compiler complains that the empty list doesn't match the instantiation state for the some_type type.

This is reproducible on taura (Linux x86-64, Mercury version rotd-2010-08-22, gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1 with default compilation options (asm_fast.gc)


Additional Information:- module inst_state.

:- interface.

:- import_module list.

:- type some_type
    ---> f1
    ; f2.

:- inst some_types_inst
    ---> f1.

    % Note that I forget to wrap the inst in a list(I) inst so that it matches
    % the type.
    %
:- pred some_pred(list(some_type)::out(some_types_inst)) is erroneous.

:- implementation.

:- import_module require.

some_pred(_) :-
    error("unimplemented").
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0001205

juliensf (administrator)

If you declare what type the inst is for you will now get such an error:

    :- inst some_types_inst for some_type/0
          ---> f1.

(Since declaring the types for insts will eventually become the default, I don't think we need to do
anything here.)
+Notes

-Issue History
Date Modified Username Field Change
2010-09-09 22:47 pbone New Issue
2022-10-11 16:43 juliensf Note Added: 0001205
+Issue History