Skip to content

Commit 8d3fc7c

Browse files
committed
type stability
1 parent 88ca4ac commit 8d3fc7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/graph_engine.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ to_symbol(label::NodeLabel) = Symbol(String(label.name) * "_" * string(label.glo
262262

263263
Base.show(io::IO, label::NodeLabel) = print(io, label.name, "_", label.global_counter)
264264
Base.:(==)(label1::NodeLabel, label2::NodeLabel) = label1.name == label2.name && label1.global_counter == label2.global_counter
265-
Base.hash(label::NodeLabel, h::UInt) = hash(label.name, hash(label.global_counter, h))
265+
Base.hash(label::NodeLabel, h::UInt) = hash(label.global_counter, h)
266266

267267
"""
268268
EdgeLabel(symbol, index)
@@ -1481,7 +1481,8 @@ end
14811481

14821482
function add_constant_node!(model::Model, context::Context, options::NodeCreationOptions, name::Symbol, index)
14831483
label = __add_variable_node!(model, context, options, name, index)
1484-
context[to_symbol(label), index] = label
1484+
context[Symbol(String(name) * "_" * string(label.global_counter)), index] = label
1485+
return label
14851486
end
14861487

14871488
function __add_variable_node!(model::Model, context::Context, options::NodeCreationOptions, name::Symbol, index)
@@ -2130,9 +2131,9 @@ Calls a plugin specific logic after the model has been created. By default does
21302131
"""
21312132
postprocess_plugin(plugin, model) = nothing
21322133

2133-
function preprocess_plugins(type::AbstractPluginTraitType, model::Model, context::Context, label, nodedata, options)
2134+
function preprocess_plugins(type::AbstractPluginTraitType, model::Model, context::Context, label::NodeLabel, nodedata::NodeData, options)
21342135
plugins = filter(type, getplugins(model))
21352136
return foldl(plugins; init = (label, nodedata)) do (label, nodedata), plugin
21362137
return preprocess_plugin(plugin, model, context, label, nodedata, options)
2137-
end
2138+
end::Tuple{NodeLabel, NodeData}
21382139
end

0 commit comments

Comments
 (0)