From dfa7d2e3b257ff2bdec0201887d50f7a31ff22c0 Mon Sep 17 00:00:00 2001 From: Giacomo Cavalieri Date: Thu, 7 Nov 2024 22:48:53 +0100 Subject: [PATCH] replace collapse_link with same_as --- compiler-core/src/error.rs | 4 ++-- compiler-core/src/type_/printer.rs | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler-core/src/error.rs b/compiler-core/src/error.rs index 967b58f38bd..7ef1ac16c4d 100644 --- a/compiler-core/src/error.rs +++ b/compiler-core/src/error.rs @@ -3999,7 +3999,7 @@ fn hint_unwrap_result( // If the got type is `Result(a, _)` and the expected one is // `a` then we can display the hint. let wrapped_type = given.result_ok_type()?; - if !wrapped_type.same_as(&expected) { + if !wrapped_type.same_as(expected) { None } else { Some(wrap_format!( @@ -4009,7 +4009,7 @@ fn hint_unwrap_result( Ok(value) -> todo Error(error) -> todo }}", - printer.print_type(&expected), + printer.print_type(expected), printer.print_type(given), )) } diff --git a/compiler-core/src/type_/printer.rs b/compiler-core/src/type_/printer.rs index 4fd0fa96d45..6e83520677e 100644 --- a/compiler-core/src/type_/printer.rs +++ b/compiler-core/src/type_/printer.rs @@ -3,7 +3,7 @@ use ecow::EcoString; use im::HashMap; use std::{collections::HashSet, sync::Arc}; -use crate::type_::{collapse_links, Type, TypeVar}; +use crate::type_::{Type, TypeVar}; /// This class keeps track of what names are used for modules in the current /// scope, so they can be printed in errors, etc. @@ -126,9 +126,7 @@ fn compare_arguments(arguments: &[Arc], parameters: &[Arc]) -> bool arguments .iter() .zip(parameters) - .all(|(argument, parameter)| { - collapse_links(argument.clone()) == collapse_links(parameter.clone()) - }) + .all(|(argument, parameter)| argument.same_as(parameter)) } impl Names {