From 28768bcfba7eac9673d1b8c515c1e3a3af28e80a Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Wed, 16 Nov 2022 14:05:03 -0600 Subject: [PATCH] Fix order of alias arg discovery --- crates/reporting/src/error/type.rs | 5 +++-- crates/reporting/tests/test_reporting.rs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs index 6941713a10..1d7c9de6c0 100644 --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -2454,12 +2454,13 @@ fn count_generated_name_usages<'a>( stack.push((ret, false)); } Alias(_, args, real, _) => { - // First, count the occurrences in the real var - stack.push((real, false)); // Then, count up any phantom args that were missed b/c they're not referenced in // the real var. Set `only_unseen` so that we don not double-count vars that do // appear in the real var. stack.extend(args.iter().map(|t| (t, true))); + + // First, count the occurrences in the real var + stack.push((real, false)); } Infinite | Error => {} Range(_) => {} diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs index e301e9c2c4..af116dfe5d 100644 --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -1330,7 +1330,7 @@ mod test_reporting { This `bar` value is a: - { bar : Int * } + { bar : Int a } But `f` needs its 1st argument to be: @@ -1398,7 +1398,7 @@ mod test_reporting { This `Blue` tag application has the type: - [Blue (Frac *)] + [Blue (Frac a)] But `f` needs its 1st argument to be: @@ -2788,7 +2788,7 @@ mod test_reporting { The argument is a record of type: - { y : Frac * } + { y : Frac a } But `f` needs its 1st argument to be: