@@ -127,7 +127,9 @@ function get_unit(op::Comparison, args)
127127end
128128
129129function get_unit (x:: SymbolicT )
130- if (u = __get_literal_unit (x)) != = nothing
130+ if isconst (x)
131+ return get_unit (value (x))
132+ elseif (u = __get_literal_unit (x)) != = nothing
131133 screen_unit (u)
132134 elseif issym (x)
133135 get_literal_unit (x)
@@ -147,7 +149,7 @@ function get_unit(x::SymbolicT)
147149 if base == unitless
148150 unitless
149151 else
150- pargs[2 ] isa Number ? base^ pargs[2 ] : (1 * base)^ pargs[2 ]
152+ isconst ( pargs[2 ]) ? base^ unwrap_const ( pargs[2 ]) : (1 * base)^ pargs[2 ]
151153 end
152154 elseif iscall (x)
153155 op = operation (x)
@@ -193,7 +195,7 @@ function _validate(terms::Vector, labels::Vector{String}; info::String = "")
193195 equnit = safe_get_unit (term, info * label)
194196 if equnit === nothing
195197 valid = false
196- elseif ! isequal (term, 0 )
198+ elseif ! SU . _iszero (term)
197199 if first_unit === nothing
198200 first_unit = equnit
199201 first_label = label
@@ -274,8 +276,8 @@ function validate(jumps::Vector{JumpType}, t::SymbolicT)
274276end
275277
276278function validate (eq:: Union{Inequality, Equation} ; info:: String = " " )
277- if typeof (eq. lhs) == Connection
278- _validate (eq. rhs; info)
279+ if isconst (eq. lhs) && value (eq . lhs) isa Connection
280+ _validate (value ( eq. rhs) :: Connection ; info)
279281 else
280282 _validate ([eq. lhs, eq. rhs], [" left" , " right" ]; info)
281283 end
0 commit comments