Skip to content

Commit be51fe3

Browse files
authored
Merge branch 'master' into s/no-bindings
2 parents ca3a0dc + 191abe3 commit be51fe3

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ Combinatorics = "1.0"
3333
ConstructionBase = "1.1"
3434
DataStructures = "0.18"
3535
DocStringExtensions = "0.8"
36-
DynamicPolynomials = "0.3"
36+
DynamicPolynomials = "0.3, 0.4"
3737
IfElse = "0.1"
3838
LabelledArrays = "1.5"
3939
Metatheory = "1.2"
40-
MultivariatePolynomials = "0.3"
40+
MultivariatePolynomials = "0.3, 0.4"
4141
NaNMath = "0.3"
4242
Setfield = "0.7, 0.8"
43-
SpecialFunctions = "0.10, 1.0"
43+
SpecialFunctions = "0.10, 1.0, 2"
4444
StaticArrays = "0.12, 1.0"
4545
TermInterface = "0.2.1"
4646
TimerOutputs = "0.5"

src/methods.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,6 @@ Base.literal_pow(::typeof(^), x::Symbolic{<:Number}, ::Val{p}) where {p} = Base.
155155
# Array-like operations
156156
Base.size(x::Symbolic{<:Number}) = ()
157157
Base.length(x::Symbolic{<:Number}) = 1
158-
Base.ndims(x::Symbolic{<:Number}) = 0
158+
Base.ndims(x::Symbolic{T}) where {T} = Base.ndims(T)
159+
Base.ndims(::Type{<:Symbolic{T}}) where {T} = Base.ndims(T)
160+
Base.broadcastable(x::Symbolic{T}) where {T<:Number} = Ref(x)

test/basics.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using SymbolicUtils: Sym, FnType, Term, Add, Mul, Pow, symtype, operation, arguments
1+
using SymbolicUtils: Symbolic, Sym, FnType, Term, Add, Mul, Pow, symtype, operation, arguments
22
using SymbolicUtils
33
using IfElse: ifelse
44
using Test
@@ -134,6 +134,16 @@ end
134134
@eqtest x // a == x / a
135135
end
136136

137+
@testset "array-like operations" begin
138+
abstract type SquareDummy end
139+
Base.:*(a::Symbolic{SquareDummy}, b) = b^2
140+
@syms s t a::SquareDummy A[1:2, 1:2]
141+
142+
@test isequal(ndims(A), 2)
143+
@test_broken isequal(a.*[1 (s+t); t pi], [1 (s+t)^2; t^2 pi^2])
144+
@test isequal(s.*[1 (s+t); t pi], [s s*(s+t); s*t s*pi])
145+
end
146+
137147
@testset "err test" begin
138148
@syms t()
139149
@test_throws ErrorException t(2)

0 commit comments

Comments
 (0)