Here is a proposed fix:
diff --git a/src/algebra/fspace.spad b/src/algebra/fspace.spad
index 3e6d3dda..29031e32 100644
--- a/src/algebra/fspace.spad
+++ b/src/algebra/fspace.spad
@@ -593,37 +593,26 @@ FunctionSpace(R : Comparable) : Category == Definition where
error concat("Unknown operator 4: ",string(name(op)))$String
if R has ConvertibleTo InputForm then
- INP==>InputForm
- import from MakeUnaryCompiledFunction(%, %, %)
- indiff : List % -> INP
- pint : List INP-> INP
- pint l == convert concat(convert('D)@INP, l)
+ import from MakeUnaryCompiledFunction(%, %, %)
+ indiff : List % -> InputForm
indiff l ==
- a3 : % := third(l)
- do_eval := false
- s : SY :=
- (su := retractIfCan(a3)@Union(SY, "failed")) case SY =>
- su::SY
- do_eval := true
- new()$SY
- -- Ugly, but otherwise interpreter may have trouble
- -- evaluating result
- si := convert([convert("::"::SY)@INP, convert(s)@INP,
- convert('Symbol)@INP])@INP
- ne := eval(first l, retract(second l)@K, (do_eval => s::%; a3))
- d1 := pint([convert(ne)@INP, si])
- do_eval =>
- convert([convert('eval)@INP, d1, si, convert(third(l))@INP])
- d1
+ -- l is a triple [function at dummy variable, dummy variable, evaluated at]
+ fun : InputForm := convert(first(l))@InputForm
+ dmy : InputForm := convert(second(l))@InputForm
+ evl : InputForm := convert(third(l))@InputForm
+ dff : InputForm := convert([convert('D)$InputForm, fun, dmy])$InputForm
+
+ dmy = evl => dff
+ convert([convert('eval)$InputForm, dff, dmy, evl])$InputForm
+
+ setProperty(opdiff, SPECIALINPUT, indiff@(List % -> InputForm) pretend None)
eval(f : %, s : OP, g : %, x : SY) == eval(f, [s], [g], x)
eval(f : %, ls : List OP, lg : List %, x : SY) ==
eval(f, ls, [compiledFunction(g, x) for g in lg])
- setProperty(opdiff, SPECIALINPUT, indiff@(List % -> InputForm) pretend None)
-
variables(lx : List(%)) ==
l := empty()$List(SY)
for k in tower lx repeat
diff --git a/src/input/bugs2019.input b/src/input/bugs2019.input
index f3268439..e71890f2 100644
--- a/src/input/bugs2019.input
+++ b/src/input/bugs2019.input
@@ -14,6 +14,10 @@ di2 := D(f(x, y^2), [x, y], [2, 1])
idi2 := di2::InputForm
testEquals("interpret(idi2) - di2", "0")
+di2 := eval(D(f(x,y), x, 1), x=y)
+idi2 := di2::InputForm
+testEquals("interpret(idi2) - di2", "0")
+
testcase "'*' and 'gcd' in Factored"
testEquals("factor(x-1)*0", "0")