Fix import to be called from anywhere

This commit is contained in:
Shunsuke Shibayama 2022-09-29 11:48:38 +09:00
parent f548f9e6ef
commit 23a6f630c9
21 changed files with 979 additions and 549 deletions

View file

@ -4,7 +4,7 @@ use erg_common::Str;
// use erg_common::error::Location;
use erg_common::{enum_unwrap, set};
use erg_type::constructors::{func1, mono_q, poly, quant, refinement};
use erg_type::constructors::{builtin_poly, func1, mono_q, quant, refinement};
use erg_type::typaram::TyParam;
use erg_type::{Predicate, TyBound, Type};
use Type::*;
@ -32,7 +32,7 @@ impl Context {
pub fn test_resolve_trait_inner1(&self) -> Result<(), ()> {
let name = Str::ever("Add");
let params = vec![TyParam::t(Nat)];
let maybe_trait = poly(name.clone(), params);
let maybe_trait = builtin_poly(name.clone(), params);
let mut min = Type::Obj;
for pair in self.rec_get_trait_impls(&name) {
if self.supertype_of(&pair.sup_trait, &maybe_trait) {
@ -48,7 +48,7 @@ impl Context {
pub fn test_instantiation_and_generalization(&self) -> Result<(), ()> {
let t = mono_q("T");
let eq = poly("Eq", vec![TyParam::t(t.clone())]);
let eq = builtin_poly("Eq", vec![TyParam::t(t.clone())]);
let bound = TyBound::subtype_of(t.clone(), eq);
let bounds = set! {bound};
let unbound_t = func1(t.clone(), t);