Skip to content

Commit

Permalink
fix: type instantiation bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Apr 20, 2024
1 parent 40c8342 commit 1da2125
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
70 changes: 35 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion crates/erg_compiler/context/instantiate_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,7 @@ impl Context {
not_found_is_qvar: bool,
) -> Failable<TyParam> {
let mut errs = TyCheckErrors::empty();
// this operation may fail but if is OK, it is recoverable
match self.instantiate_const_expr(&app.obj, erased_idx, tmp_tv_cache, not_found_is_qvar) {
Ok(obj) => {
let ctx = self
Expand Down Expand Up @@ -1348,10 +1349,11 @@ impl Context {
}
}
Err((_tp, es)) => {
errs.extend(es);
let Some(attr_name) = app.attr_name.as_ref() else {
errs.extend(es);
return Err((TyParam::Failure, errs));
};
// recover process (`es` are cleared)
let acc = app.obj.clone().attr(attr_name.clone());
let attr =
self.instantiate_acc(&acc, erased_idx, tmp_tv_cache, not_found_is_qvar)?;
Expand Down

0 comments on commit 1da2125

Please sign in to comment.