-
Notifications
You must be signed in to change notification settings - Fork 25
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
Equality visitor #2335
Equality visitor #2335
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key is to have something like
bool operator==(const Node& node1, const Node& node2)
that works for all node types. I'm not sure your implementation does that.
src/solver/expressions/include/antares/solver/expressions/nodes/TwoNodesVisitor.h
Show resolved
Hide resolved
return ret.value(); | ||
} | ||
} | ||
logs.error() << "Antares::Solver::Nodes Visitor: unsupported Node!"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If node1
and node2
are of different types, we will encounter this line. So I think we should handle errors better here.
Example
Literal lit1(2), lit2(2);
AddNode node1(&lit1, &lit2);
MultiplicationNode node2(&lit1, &lit2);
EqualityVisitor equal;
// Here, we go through l. 78 above, but the caller only gets a log error
// and an `R()`, not so easy to catch
equal.dispatch(&node1, &node2);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update: the code print warning message and returns false
} | ||
else | ||
{ | ||
return {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different node types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the return type is handled in the dispatch method
draft