Skip to content

Commit 18a54f5

Browse files
committed
Add test
1 parent 1f8d1a0 commit 18a54f5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/types.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ function _promote_symtype(f, args)
302302
elseif length(args) == 2
303303
promote_symtype(f, symtype(args[1]), symtype(args[2]))
304304
elseif isassociative(f)
305-
# TODO: maybe restrict it only to functions that are Associative
306305
mapfoldl(symtype, (x,y) -> promote_symtype(f, x, y), args)
307306
else
308307
promote_symtype(f, map(symtype, args)...)

test/basics.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ end
6666
@test isequal(a + x, Add(Number, 0, Dict(a=>1, x=>1)))
6767
@test isequal(a + z, Add(Number, 0, Dict(a=>1, z=>1)))
6868

69+
foo(w, z, a, b) = 1.0
70+
SymbolicUtils.promote_symtype(::typeof(foo), args...) = Real
71+
@test SymbolicUtils._promote_symtype(foo, (w, z, a, b,)) === Real
72+
6973
# promote_symtype of identity
7074
@test isequal(Term(identity, [w]), Term{Complex}(identity, [w]))
7175
@test isequal(+(w), w)

0 commit comments

Comments
 (0)