mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix: add set_recursion_limit!
This commit is contained in:
parent
de3b3a467b
commit
73f8be7ae1
5 changed files with 52 additions and 16 deletions
|
@ -7,7 +7,7 @@ use erg_common::dict::Dict;
|
|||
use erg_common::set::Set;
|
||||
use erg_common::style::colors::DEBUG_ERROR;
|
||||
use erg_common::traits::StructuralEq;
|
||||
use erg_common::{assume_unreachable, log};
|
||||
use erg_common::{assume_unreachable, log, set_recursion_limit};
|
||||
use erg_common::{Str, Triple};
|
||||
|
||||
use crate::context::eval::UndoableLinkedList;
|
||||
|
@ -126,6 +126,7 @@ impl Context {
|
|||
|
||||
/// lhs :> rhs ?
|
||||
pub(crate) fn supertype_of(&self, lhs: &Type, rhs: &Type) -> bool {
|
||||
set_recursion_limit!(false, 128);
|
||||
let res = match Self::cheap_supertype_of(lhs, rhs) {
|
||||
(Absolutely, judge) => judge,
|
||||
(Maybe, judge) => {
|
||||
|
|
|
@ -9,7 +9,7 @@ use erg_common::log;
|
|||
use erg_common::set::Set;
|
||||
use erg_common::shared::Shared;
|
||||
use erg_common::traits::{Locational, Stream};
|
||||
use erg_common::{dict, fmt_vec, fn_name, option_enum_unwrap, set, Triple};
|
||||
use erg_common::{dict, fmt_vec, fn_name, option_enum_unwrap, set, set_recursion_limit, Triple};
|
||||
use erg_common::{ArcArray, Str};
|
||||
use OpKind::*;
|
||||
|
||||
|
@ -2061,6 +2061,7 @@ impl Context {
|
|||
level: usize,
|
||||
t_loc: &impl Locational,
|
||||
) -> Failable<Type> {
|
||||
set_recursion_limit!(Ok(Failure), 128);
|
||||
let mut errs = EvalErrors::empty();
|
||||
match substituted {
|
||||
Type::FreeVar(fv) if fv.is_linked() => {
|
||||
|
|
|
@ -4,12 +4,12 @@ use std::option::Option; // conflicting to Type::Option
|
|||
|
||||
use erg_common::consts::DEBUG_MODE;
|
||||
use erg_common::dict::Dict;
|
||||
use erg_common::enum_unwrap;
|
||||
#[allow(unused)]
|
||||
use erg_common::log;
|
||||
use erg_common::set::Set;
|
||||
use erg_common::traits::Locational;
|
||||
use erg_common::Str;
|
||||
use erg_common::{enum_unwrap, set_recursion_limit};
|
||||
use erg_parser::ast::VarName;
|
||||
|
||||
use crate::ty::constructors::*;
|
||||
|
@ -790,6 +790,8 @@ impl Context {
|
|||
tmp_tv_cache: &mut TyVarCache,
|
||||
loc: &impl Locational,
|
||||
) -> TyCheckResult<Type> {
|
||||
// Structural types may have recursive structures
|
||||
set_recursion_limit!(Ok(unbound), 128);
|
||||
match unbound {
|
||||
FreeVar(fv) if fv.is_linked() => {
|
||||
let t = fv.crack().clone();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue