Files
mercury/tests/hard_coded/coerce_existq.exp
Peter Wang d013421326 Modecheck coerce of terms with existential types.
The modechecking for coerce did not take into account existentially
typed arguments in the term being coerced. There are two main changes:

1. If the input (sub)term being coerced has an existential type, the
   result must have the same type. Therefore, we can use the inst
   approximating the input (sub)term for the result.

2. Each existentially quantified type variable or existential class
   constraint on a data constructor adds a type_info or type_class_info
   to the resulting heap cell. Internally, the inst for that cell will
   include insts for those extra arguments, which the modechecker for
   coerce will need to be aware of.

Fixes GitHub issue #132

compiler/modecheck_coerce.m:
    As above.

doc/reference_manual.texi:
    Account for existential types in the description of
    how modechecking of coerce works.

tests/hard_coded/Mmakefile:
tests/hard_coded/coerce_existq.exp:
tests/hard_coded/coerce_existq.m:
    Add test case.
2024-07-11 16:17:48 +10:00

19 lines
328 B
Plaintext

box(foo(0), 1, "two", 3.333, {"four", 5})
arg 1: foo
arg 2: int
arg 3: string
arg 4: float
arg 5: {}(string, int)
Calling methods: owt, 333.3
box(foo(0), 1, "two", 3.333, {"four", 5})
arg 1: foo
arg 2: int
arg 3: string
arg 4: float
arg 5: {}(string, int)
Calling methods: owt, 333.3