2024-05-18 23:22 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000347mercuryBugpublic2014-08-12 19:53
Reporterlpimmes 
Assigned Tozs 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformmacOSosxOS Version10.9
Product Version 
Target VersionFixed in Version 
Summary0000347: Typing problem; how to represent 'types with additional info) in base type. See below.
Description    % included (by itself) works but I want included(none, 1)
    array2d.set(1, R, included(none, 1), InArr, UpdArr)

included( ....) is a kind of info as :- type declarations show this.
Not sure how represent in a calling function/predicate; line 75 knapsackDP_lib.m

knapsackDP 501>make
...
Making Mercury/ints/knapsackDP_lib.int
Making Mercury/cs/knapsackDP_lib.c
knapsackDP_lib.m:075: In clause for function `updArr'/2:
knapsackDP_lib.m:075: in argument 4 of call to predicate `array2d.set'/5:
knapsackDP_lib.m:075: type error: variable `InArr' has type
knapsackDP_lib.m:075: `array2d.array2d(knapsackDP_lib.info)',
knapsackDP_lib.m:075: expected type was
knapsackDP_lib.m:075: `array2d.array2d(knapsackDP_lib.included)'.
knapsackDP_lib.m:075: The partial type assignment was:
knapsackDP_lib.m:075: R_4: int
knapsackDP_lib.m:075: InArr_5: array2d.array2d(knapsackDP_lib.info)
knapsackDP_lib.m:075: UpdArr_6: array2d.array2d(knapsackDP_lib.info)
knapsackDP_lib.m:075: V_7: int
knapsackDP_lib.m:075: V_8: knapsackDP_lib.included
knapsackDP_lib.m:075: V_9: knapsackDP_lib.infoP
knapsackDP_lib.m:075: V_10: int
knapsackDP_lib.m:075: In clause for function `updArr'/2:
... error log truncated, see `knapsackDP_lib.err' for the complete log.
** Error making `Mercury/cs/knapsackDP_lib.c'.
Steps To ReproduceSee .zip file for *.m and Makefile.
Extract into a directory then do
 > make

Thanks for your time.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000746

lpimmes (reporter)

Problem work around: by using a less complicated solution:


:- type status ---> included; omitted; includedAndOmitted; noSolution; notUsed; notSet.
            % notUsed: meaning index is not in range because of 0 based counting
            % notSet: my problem, if I didn't update value in progrom to:
            % either included, omitted, includeAndOmitted, or noSolution.

:- type info ---> info( % only for included, but optional- 0,0 means not applicable
                        n_om :: int, k_om :: int,
                        n_inc :: int, k_inc :: int,
                        theStatus :: status,
                        kToPack :: int % part of return answer
                      ).

~0000749

wangp (developer)

You could do this:

:- type info
    ---> included(included)
    ; omitted(omitted)
    ; includedAndOmitted(included, omitted)
    ; noSolution
    ; notUsed
    ; notSet.

:- type included
    ---> included(
                gotoInc :: infoP,
                kToPack :: int
            ).

:- type omitted
    ---> omitted(
                gotoOm :: infoP
            ).

~0000761

zs (developer)

Not a compiler bug.
+Notes

-Issue History
Date Modified Username Field Change
2014-07-16 05:47 lpimmes New Issue
2014-07-16 05:47 lpimmes File Added: compErr.zip
2014-07-18 06:21 lpimmes Note Added: 0000746
2014-07-18 16:38 wangp Note Added: 0000749
2014-08-12 19:53 zs Note Added: 0000761
2014-08-12 19:53 zs Status new => closed
2014-08-12 19:53 zs Assigned To => zs
2014-08-12 19:53 zs Resolution open => no change required
+Issue History