Skip to content

Commit 0a4f743

Browse files
Merge pull request #2999 from contradict/get_unit_typo_fix
Fix typo in get_unit for ops
2 parents b25e64a + 76f6d17 commit 0a4f743

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)