Update inquire.rs

This commit is contained in:
Shunsuke Shibayama 2022-09-21 22:15:09 +09:00
parent bbd66e5936
commit d452a2d734

View file

@ -85,20 +85,18 @@ impl Context {
fn get_singular_ctx(&self, obj: &hir::Expr, namespace: &Str) -> TyCheckResult<&Context> { fn get_singular_ctx(&self, obj: &hir::Expr, namespace: &Str) -> TyCheckResult<&Context> {
match obj { match obj {
hir::Expr::Accessor(hir::Accessor::Ident(ident)) => { hir::Expr::Accessor(hir::Accessor::Ident(ident)) => self
log!(err "{ident}: {}", self.get_mod(ident.inspect()).is_some()); .get_mod(ident.inspect())
self.get_mod(ident.inspect()) .or_else(|| self.rec_get_type(ident.inspect()).map(|(_, ctx)| ctx))
.or_else(|| self.rec_get_type(ident.inspect()).map(|(_, ctx)| ctx)) .ok_or_else(|| {
.ok_or_else(|| { TyCheckError::no_var_error(
TyCheckError::no_var_error( line!() as usize,
line!() as usize, obj.loc(),
obj.loc(), namespace.into(),
namespace.into(), ident.inspect(),
ident.inspect(), self.get_similar_name(ident.inspect()),
self.get_similar_name(ident.inspect()), )
) }),
})
}
hir::Expr::Accessor(hir::Accessor::Attr(attr)) => { hir::Expr::Accessor(hir::Accessor::Attr(attr)) => {
// REVIEW: 両方singularとは限らない? // REVIEW: 両方singularとは限らない?
let ctx = self.get_singular_ctx(&attr.obj, namespace)?; let ctx = self.get_singular_ctx(&attr.obj, namespace)?;
@ -532,7 +530,6 @@ impl Context {
None None
} }
}) { }) {
log!(info "{}, {}", callee.ref_t(), after);
self.reunify(callee.ref_t(), after, Some(callee.loc()), None)?; self.reunify(callee.ref_t(), after, Some(callee.loc()), None)?;
} }
} }