Skip to content

Commit 76f6d17

Browse files
committed
Fix typo in get_unit for ops
I'm almost sure this is a typo since otherwise the try/catch block doesn't makes sense and fixing this fixes an error during documentation build.
1 parent 2813251 commit 76f6d17

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/systems/unit_check.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ get_unit(op::typeof(instream), args) = get_unit(args[1])
7878
function get_unit(op, args) # Fallback
7979
result = op(get_unit.(args)...)
8080
try
81-
result
81+
get_unit(result)
8282
catch
8383
throw(ValidationError("Unable to get unit for operation $op with arguments $args."))
8484
end

test/units.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,6 @@ end
220220

221221
@named sys = ArrayParamTest(a = [1.0, 3.0]u"cm")
222222
@test ModelingToolkit.getdefault(sys.a) [0.01, 0.03]
223+
224+
@variables x(t)
225+
@test ModelingToolkit.get_unit(sin(x)) == ModelingToolkit.unitless

0 commit comments

Comments
 (0)