mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix: crack
crash
This commit is contained in:
parent
f1d71e0dab
commit
cce95e7210
5 changed files with 55 additions and 20 deletions
|
@ -333,7 +333,8 @@ impl Context {
|
|||
) -> TyCheckResult<TyParam> {
|
||||
match quantified {
|
||||
TyParam::FreeVar(fv) if fv.is_linked() => {
|
||||
self.instantiate_tp(fv.crack().clone(), tmp_tv_cache, loc)
|
||||
let tp = fv.crack().clone();
|
||||
self.instantiate_tp(tp, tmp_tv_cache, loc)
|
||||
}
|
||||
TyParam::FreeVar(fv) if fv.is_generalized() => {
|
||||
let (name, constr) = (fv.unbound_name().unwrap(), fv.constraint().unwrap());
|
||||
|
@ -655,7 +656,8 @@ impl Context {
|
|||
) -> TyCheckResult<Type> {
|
||||
match unbound {
|
||||
FreeVar(fv) if fv.is_linked() => {
|
||||
self.instantiate_t_inner(fv.crack().clone(), tmp_tv_cache, loc)
|
||||
let t = fv.crack().clone();
|
||||
self.instantiate_t_inner(t, tmp_tv_cache, loc)
|
||||
}
|
||||
FreeVar(fv) if fv.is_generalized() => {
|
||||
let (name, constr) = (fv.unbound_name().unwrap(), fv.constraint().unwrap());
|
||||
|
@ -829,7 +831,10 @@ impl Context {
|
|||
|
||||
pub(crate) fn instantiate(&self, quantified: Type, callee: &hir::Expr) -> TyCheckResult<Type> {
|
||||
match quantified {
|
||||
FreeVar(fv) if fv.is_linked() => self.instantiate(fv.crack().clone(), callee),
|
||||
FreeVar(fv) if fv.is_linked() => {
|
||||
let t = fv.crack().clone();
|
||||
self.instantiate(t, callee)
|
||||
}
|
||||
And(lhs, rhs) => {
|
||||
let lhs = self.instantiate(*lhs, callee)?;
|
||||
let rhs = self.instantiate(*rhs, callee)?;
|
||||
|
@ -889,7 +894,10 @@ impl Context {
|
|||
|
||||
pub(crate) fn instantiate_dummy(&self, quantified: Type) -> TyCheckResult<Type> {
|
||||
match quantified {
|
||||
FreeVar(fv) if fv.is_linked() => self.instantiate_dummy(fv.crack().clone()),
|
||||
FreeVar(fv) if fv.is_linked() => {
|
||||
let t = fv.crack().clone();
|
||||
self.instantiate_dummy(t)
|
||||
}
|
||||
And(lhs, rhs) => {
|
||||
let lhs = self.instantiate_dummy(*lhs)?;
|
||||
let rhs = self.instantiate_dummy(*rhs)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue