mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
use new sccs in error case too
This commit is contained in:
parent
887acb7519
commit
c763d51551
1 changed files with 7 additions and 7 deletions
|
@ -976,13 +976,13 @@ pub fn sort_can_defs_improved(
|
|||
//
|
||||
// foo = if b then foo else bar
|
||||
|
||||
let all_successors_without_self = |id: &u32| {
|
||||
let id = *id;
|
||||
def_ids.successors_without_self(id)
|
||||
};
|
||||
let sccs = strongly_connected_components_improved(
|
||||
def_ids.length as usize,
|
||||
&def_ids.references,
|
||||
&nodes_in_cycle,
|
||||
);
|
||||
|
||||
for cycle in strongly_connected_components(&nodes_in_cycle, all_successors_without_self)
|
||||
{
|
||||
for cycle in sccs {
|
||||
// check whether the cycle is faulty, which is when it has
|
||||
// a direct successor in the current cycle. This catches things like:
|
||||
//
|
||||
|
@ -1063,7 +1063,7 @@ pub fn sort_can_defs_improved(
|
|||
// for each symbol in this group
|
||||
for symbol in &groups[*group_id] {
|
||||
// find its successors
|
||||
for succ in all_successors_without_self(symbol) {
|
||||
for succ in def_ids.successors_without_self(*symbol) {
|
||||
// and add its group to the result
|
||||
match symbol_to_group_index.get(&succ) {
|
||||
Some(index) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue