diff --git a/examples/typechecking/instantiation.an b/examples/typechecking/instantiation.an index 0e6ba989..1f19dff2 100644 --- a/examples/typechecking/instantiation.an +++ b/examples/typechecking/instantiation.an @@ -17,5 +17,5 @@ id x = x // add : (forall a b c d e f g h i. ((a - c => e can g) - (a - b => c can g) -> (a => (b => e can g) can h) can i)) // id : (forall a b. (a -> a can b)) // one : (forall a b c d. ((a => b can d) - a -> b can d)) -// two1 : (forall a b c. ((a => a can c) - a -> a can c)) +// two1 : (forall a b c. ((b => b can c) - b -> b can c)) // two2 : ((a => a can c) => (a => a can c) can d) diff --git a/src/hir/monomorphisation.rs b/src/hir/monomorphisation.rs index 92fdfc8b..932326f9 100644 --- a/src/hir/monomorphisation.rs +++ b/src/hir/monomorphisation.rs @@ -700,8 +700,8 @@ impl<'c> Context<'c> { if definition.trait_impl.is_some() { let definition_type = definition.typ.as_ref().unwrap().remove_forall(); let bindings = typechecker::try_unify( - definition_type, typ, + definition_type, definition.location, &mut self.cache, TE::MonomorphizationError, diff --git a/src/types/traitchecker.rs b/src/types/traitchecker.rs index f2d2575f..369e9b77 100644 --- a/src/types/traitchecker.rs +++ b/src/types/traitchecker.rs @@ -288,8 +288,8 @@ fn find_matching_normal_impls( let location = constraint.locate(cache); let type_bindings = typechecker::try_unify_all_with_bindings( - &impl_typeargs, constraint.args(), + &impl_typeargs, bindings.clone(), location, cache, diff --git a/src/types/typechecker.rs b/src/types/typechecker.rs index 67f51e5a..d9e06dba 100644 --- a/src/types/typechecker.rs +++ b/src/types/typechecker.rs @@ -66,7 +66,7 @@ type LevelBindings = Vec<(TypeVariableId, LetBindingLevel)>; /// Arbitrary limit of maximum recursive calls to functions like find_binding. /// Expected not to happen but leads to better errors than a stack overflow when it does. -const RECURSION_LIMIT: u32 = 15; +const RECURSION_LIMIT: u32 = 100; #[derive(Debug, Clone)] pub struct UnificationBindings { @@ -716,6 +716,9 @@ pub fn try_unify_with_bindings_inner<'b>( // ! <: & (Tag(TypeTag::Mutable), Tag(TypeTag::Immutable)) => Ok(()), + // owned <: shared + (Tag(TypeTag::Owned), Tag(TypeTag::Shared)) => Ok(()), + _ => Err(()), } }