cl-typeck: Twiddle with infer (maybe this will help fix the weird behavior?)
This commit is contained in:
parent
ccfa4c7723
commit
08b5937fc2
@ -451,14 +451,10 @@ impl<'a> Inference<'a> for Path {
|
|||||||
impl<'a> Inference<'a> for Let {
|
impl<'a> Inference<'a> for Let {
|
||||||
fn infer(&'a self, e: &mut InferenceEngine<'_, 'a>) -> IfResult {
|
fn infer(&'a self, e: &mut InferenceEngine<'_, 'a>) -> IfResult {
|
||||||
let Let { mutable: _, name, ty, init } = self;
|
let Let { mutable: _, name, ty, init } = self;
|
||||||
// Deep copy the ty, if it exists
|
|
||||||
let ty = match ty {
|
let ty = match ty {
|
||||||
Some(ty) => {
|
Some(ty) => ty
|
||||||
let ty = ty
|
|
||||||
.evaluate(e.table, e.at)
|
.evaluate(e.table, e.at)
|
||||||
.map_err(InferenceError::AnnotationEval)?;
|
.map_err(InferenceError::AnnotationEval)?,
|
||||||
e.deep_clone(ty)
|
|
||||||
}
|
|
||||||
None => e.new_var(),
|
None => e.new_var(),
|
||||||
};
|
};
|
||||||
// Infer the initializer
|
// Infer the initializer
|
||||||
@ -467,6 +463,8 @@ impl<'a> Inference<'a> for Let {
|
|||||||
let initty = init.infer(e)?;
|
let initty = init.infer(e)?;
|
||||||
e.unify(ty, initty)?;
|
e.unify(ty, initty)?;
|
||||||
}
|
}
|
||||||
|
// Deep copy the ty, if it exists
|
||||||
|
let ty = e.deep_clone(ty);
|
||||||
// Enter a local scope (modifies the current scope)
|
// Enter a local scope (modifies the current scope)
|
||||||
e.local_scope();
|
e.local_scope();
|
||||||
// Infer the pattern
|
// Infer the pattern
|
||||||
|
Loading…
x
Reference in New Issue
Block a user