mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 21:03:53 +00:00
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.
19 lines
328 B
Plaintext
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
|
|
|