Skip to content

Commit

Permalink
replace collapse_link with same_as
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomocavalieri committed Jan 6, 2025
1 parent 377eb28 commit dfa7d2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions compiler-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -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),
))
}
Expand Down
6 changes: 2 additions & 4 deletions compiler-core/src/type_/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -126,9 +126,7 @@ fn compare_arguments(arguments: &[Arc<Type>], parameters: &[Arc<Type>]) -> 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 {
Expand Down

0 comments on commit dfa7d2e

Please sign in to comment.