use the full alias body to determine the rank

This commit is contained in:
Folkert 2020-10-18 23:05:03 +02:00
parent 7b4e87a671
commit e1290835de

View file

@ -1209,14 +1209,19 @@ fn adjust_rank_content(
}
}
Alias(_, args, _) => {
Alias(_, args, real_var) => {
let mut rank = Rank::toplevel();
// from elm-compiler: THEORY: anything in the real_var would be Rank::toplevel()
for (_, var) in args {
rank = rank.max(adjust_rank(subs, young_mark, visit_mark, group_rank, var));
}
// from elm-compiler: THEORY: anything in the real_var would be Rank::toplevel()
// this theory is not true in Roc! aliases of function types capture the closure var
rank = rank.max(adjust_rank(
subs, young_mark, visit_mark, group_rank, real_var,
));
rank
}
}