混合 CLP(FD) 和 if-then-else 构造时出现编译错误

Compilation error when mixing CLP(FD) and if-then-else construct

我不明白为什么下面的代码不能编译;它会产生 put_attr/3: Uninstantiated argument expected, found 2 (1-st argument) 错误:

:- use_module(library(clpfd)).

test(X, Y) :-
    (   X = 1
    ->  Y #= 2
    ;   Y = 3
    ).

以下代码也无法编译:

test(X, Y) :-
    (   X = 1
    ->  Y = 2
    ;   Y #= 3
    ).

我不明白这是为什么。用简单的统一 = 替换 #= 可以编译,但我不明白为什么考虑到这个谓词不能编译:

test(X, Y) :-
    (   X = 1
    ->  Y #= 2*_
    ;   Y = 3
    ).

编译成功!

这是 library(clpfd) 目标扩展的错误。

this commit 起,Markus Triska 已修复此问题。