diff --git a/compiler/src/mir/specialize.rs b/compiler/src/mir/specialize.rs index 775b74943..c9e973b68 100644 --- a/compiler/src/mir/specialize.rs +++ b/compiler/src/mir/specialize.rs @@ -976,7 +976,6 @@ impl<'a, 'b> Specialize<'a, 'b> { // We can reach this point if our parameter is assigned to a // type parameter bound, and the shape for that is already // generated by the above loop. - // shapes.insert(par, *shape); continue; } } diff --git a/compiler/src/type_check/expressions.rs b/compiler/src/type_check/expressions.rs index 57cd7dfeb..b214e24b1 100644 --- a/compiler/src/type_check/expressions.rs +++ b/compiler/src/type_check/expressions.rs @@ -341,17 +341,21 @@ impl MethodCall { && !method.is_moving(&state.db); let bounds = if let Some((self_id, self_method)) = surrounding_scope { - // When calling a method on `self`, we need to take any surrounding - // bounds into account when resolving types. if self_id == receiver_id { self_method.bounds(&state.db).union(method.bounds(&state.db)) } else { - self_method.bounds(&state.db).clone() + method.bounds(&state.db).clone() } } else { - TypeBounds::new() + method.bounds(&state.db).clone() }; + // TODO: remove + if method.name(&state.db) == "my_eq" { + println!("method: {}", method.0); + println!("type bounds: {:?}\n", bounds); + } + // If the receiver is rigid, it may introduce additional type arguments // through its type parameter requirements. We need to ensure that these // are all returned as rigid parameters as well. In addition, we need to diff --git a/types/src/check.rs b/types/src/check.rs index e413e094c..96ea47f37 100644 --- a/types/src/check.rs +++ b/types/src/check.rs @@ -535,6 +535,13 @@ impl<'a> TypeChecker<'a> { }; if allow { + // TODO: remove + if left_id.id == 642 { + println!("value: {:?}", right); + println!("left: {:?}", env.left); + println!("right: {:?}", env.right); + } + left_id.assign(self.db, right); } @@ -1115,7 +1122,8 @@ impl<'a> TypeChecker<'a> { arguments: &TypeArguments, rules: Rules, ) -> TypeRef { - match arguments.get(id) { + // TODO: add tests for using a bound here + match arguments.get(id.original(self.db).unwrap_or(id)) { Some(arg @ TypeRef::Placeholder(id)) => id .value(self.db) .map(|v| self.resolve(v, arguments, rules))