Ruby: Make module graph queries avoid relying on evalaution order. #19116
+66
−44
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Graphs use the internal id if
semmle.order
is not good enough. However the internal id of anewtype
depends on evaluation order (and in this case whetherTResolved
orTUnresolved
is evaluated first). It seems the current evaluator is very consistent but RTJO changes it. In theory though the current evaluator could get the wrong result as multiple threads can change scheduling order.I am looking into making the graph code use the label as an intermediate order. However we end up still needing us to make this test deterministic as the change would break this test.
This just adds the
toString
as an order when the location is not defined, I have put these first in the order as that matches the existing results better (ifsemmle.order
is not defined then it is treated 0).I have duplicated this code as it is already duplicated but I am happy to put this in a
qll
instead as this code has grown in size.