Mercury Bugs - mercury
View Issue Details
0000257mercuryBugpublic2012-06-22 12:492013-05-21 14:04
Reporterwangp 
Assigned Tojuliensf 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000257: require_complete_switch var does not appear in sub-goal
DescriptionThe compiler doesn't warn if the variable named in a
require_complete_switch does not appear anywhere in the sub-goal, e.g.

    :- type xyz ---> x ; y ; z.
          
    :- pred oops(xyz::in, int::out) is semidet.
    
    oops(G, N) :-
        require_complete_switch [Gee]
        (
            G = x,
            N = 1
        ;
            G = y,
            fail
        ).
TagsNo tags attached.
Attached Files

Notes
(0000520)
juliensf   
2013-05-20 16:42   
Even better, consider what happens (or rather doesn't happen) with:

oops(G, N) :-
        some [Gee]
        (
            G = x,
            N = 1
        ;
            G = y,
            fail
        ).
(0000521)
juliensf   
2013-05-20 17:48   
Fix posted for review.
(0000522)
juliensf   
2013-05-21 14:04   
The compiler now emits a warning in this case.

Issue History
2012-06-22 12:49wangpNew Issue
2013-05-20 16:42juliensfNote Added: 0000520
2013-05-20 17:48juliensfAssigned To => juliensf
2013-05-20 17:48juliensfStatusnew => assigned
2013-05-20 17:48juliensfNote Added: 0000521
2013-05-21 14:04juliensfNote Added: 0000522
2013-05-21 14:04juliensfStatusassigned => resolved
2013-05-21 14:04juliensfResolutionopen => fixed