Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekun Wang committed Nov 16, 2023
1 parent bdbcb0a commit 4b6645b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion third_party/move/move-compiler/src/typing/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ fn type_with_context_msg(context: &mut Context, ty: &mut Type, msg_uninferred: &
let replacement = unfold_type_or_last_var(&context.subst, ty_tvar);
let replacement = match replacement {
Err(sp!(loc, last_tvar)) => {
// avoid duplicate error messages
// this is to avoid duplicate error messages for uninferred type variables
// in the first time they are resolved to Err(_), and to Anything for all following queries
context.subst.insert(last_tvar, sp(ty.loc, Type_::Anything));
context
.env
Expand Down Expand Up @@ -141,6 +142,7 @@ fn type_with_context_msg(context: &mut Context, ty: &mut Type, msg_uninferred: &
}
}

// Try to expand the type of ty, warning with msg_uninferred if type cannot be inferred.
pub fn type_(context: &mut Context, ty: &mut Type) {
type_with_context_msg(
context,
Expand Down

0 comments on commit 4b6645b

Please sign in to comment.