Skip to content

Commit 3afc9c0

Browse files
committed
Minor refactor: Be consistent about alias_eliminate_graph! return type
Generally, it's bad style to change the return type in a corner cases, because a lot of the time (as I happed to), users will mostly test the common case and then when the corner case (in this case no linear equations in the system) comes up, things break. Simplify things by being consistent about the return types.
1 parent c87aaad commit 3afc9c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/systems/alias_elimination.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const KEEP = typemin(Int)
44

55
function alias_eliminate_graph!(state::TransformationState)
66
mm = linear_subsys_adjmat(state)
7-
size(mm, 1) == 0 && return nothing, mm, BitSet() # No linear subsystems
7+
size(mm, 1) == 0 && return AliasGraph(ndsts(state.structure.graph)), mm, BitSet() # No linear subsystems
88

99
@unpack graph, var_to_diff = state.structure
1010

@@ -37,7 +37,7 @@ function alias_elimination!(state::TearingState)
3737
sys = state.sys
3838
complete!(state.structure)
3939
ag, mm, updated_diff_vars = alias_eliminate_graph!(state)
40-
ag === nothing && return sys
40+
isempty(ag) && return sys
4141

4242
fullvars = state.fullvars
4343
@unpack var_to_diff, graph = state.structure

0 commit comments

Comments
 (0)