mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 21:33:49 +00:00
Estimated hours taken: 0.75 compiler/modecheck_unify.m: Fix a bug which caused the compiler to generate incorrect code for the case where a function had the same name and arity as a data constructor (but a different return type), and the data constructor was used with an explicit module qualifier -- it incorrectly ignored the types and chose the function rather than the data constructor. tests/hard_coded/Mmakefile: tests/hard_coded/func_ctor_ambig.m: tests/hard_coded/func_ctor_ambig.exp: Regression test.
36 lines
580 B
Mathematica
36 lines
580 B
Mathematica
% Mercury 0.7.3 generated incorrect code for this test case.
|
|
|
|
:- module func_ctor_ambig.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- type t.
|
|
:- func bar = int.
|
|
:- func baz = t.
|
|
:- func bar2 = int.
|
|
:- func baz2 = t.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main -->
|
|
print("bar = "), print(bar), nl,
|
|
print("bar2 = "), print(bar2), nl,
|
|
print("baz = "), print(baz), nl,
|
|
print("baz2 = "), print(baz2), nl.
|
|
|
|
:- type t ---> ambig.
|
|
|
|
:- func ambig = int.
|
|
ambig = 42.
|
|
|
|
bar = ambig.
|
|
|
|
baz = ambig.
|
|
|
|
bar2 = func_ctor_ambig:ambig.
|
|
|
|
baz2 = func_ctor_ambig:ambig.
|
|
|