Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix method redefinition #2698

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/discretedomain.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Symbolics: Operator, Num, Term, value, recursive_hasoperator

struct SampleTime <: Operator end
SymbolicUtils.promote_symtype(::Type{SampleTime}, t...) = Real
function SampleTime()
SymbolicUtils.term(SampleTime, type = Real)
struct SampleTime <: Operator
SampleTime() = SymbolicUtils.term(SampleTime, type = Real)

Check warning on line 4 in src/discretedomain.jl

View check run for this annotation

Codecov / codecov/patch

src/discretedomain.jl#L4

Added line #L4 was not covered by tests
end
SymbolicUtils.promote_symtype(::Type{<:SampleTime}, t...) = Real

Check warning on line 6 in src/discretedomain.jl

View check run for this annotation

Codecov / codecov/patch

src/discretedomain.jl#L6

Added line #L6 was not covered by tests

# Shift

Expand Down
2 changes: 1 addition & 1 deletion src/systems/clock_inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
ClockInference(ts, eq_domain, var_domain, inferred)
end

struct NotInferedTimeDomain end

Check warning on line 24 in src/systems/clock_inference.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Infered" should be "Inferred".
function error_sample_time(eq)
error("$eq\ncontains `SampleTime` but it is not an infered discrete equation.")

Check warning on line 26 in src/systems/clock_inference.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"infered" should be "inferred".
end
function substitute_sample_time(ci::ClockInference)
@unpack ts, eq_domain = ci
Expand All @@ -34,7 +34,7 @@
domain = eq_domain[i]
dt = sampletime(domain)
neweq = substitute_sample_time(eq, dt)
if neweq isa NotInferedTimeDomain

Check warning on line 37 in src/systems/clock_inference.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Infered" should be "Inferred".
error_sample_time(eq)
end
eqs[i] = neweq
Expand All @@ -52,18 +52,18 @@
op = operation(ex)
args = arguments(ex)
if op == SampleTime
dt === nothing && return NotInferedTimeDomain()

Check warning on line 55 in src/systems/clock_inference.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Infered" should be "Inferred".
return dt
else
new_args = similar(args)
for (i, arg) in enumerate(args)
ex_arg = substitute_sample_time(arg, dt)
if ex_arg isa NotInferedTimeDomain

Check warning on line 61 in src/systems/clock_inference.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"Infered" should be "Inferred".
return ex_arg
end
new_args[i] = ex_arg
end
similarterm(ex, op, new_args; metadata = metadata(ex))
similarterm(ex, op, new_args, symtype(ex); metadata = metadata(ex))
end
end

Expand Down
Loading