:- module type_qual_bug. :- interface. :- pred bug1 is det. :- pred bug2 is det. :- implementation. :- type foo1 ---> foo(int). :- type foo2 ---> foo(int). bug1 :- % X is assigned the type foo1 due to an explicit type qualification. % Later, when the Xs are renamed apart, the type is copied over to both % new variables. Obviously, the two Xs are not supposed to be related. some [X] ( X = foo(1) : foo1 ), some [X] ( X = foo(2) : foo2 ). bug2 :- % Both X variables end up with type foo2, so this compiles. % But the type of the first X should be ambiguous. some [X] ( X = foo(1) ), some [X] ( X = foo(2) : foo2 ).