mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-01 13:11:11 +00:00
Update tyvar.rs
This commit is contained in:
parent
d6b0d13dc1
commit
929f777960
1 changed files with 15 additions and 10 deletions
|
@ -657,22 +657,27 @@ impl Context {
|
||||||
super_exists
|
super_exists
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_trait_impl(
|
fn check_trait_impl(&self, class: &Type, trait_: &Type, loc: Location) -> TyCheckResult<()> {
|
||||||
&self,
|
|
||||||
class: &Type,
|
|
||||||
trait_: &Type,
|
|
||||||
loc: Location,
|
|
||||||
) -> SingleTyCheckResult<()> {
|
|
||||||
if !self.trait_impl_exists(class, trait_) {
|
if !self.trait_impl_exists(class, trait_) {
|
||||||
Err(TyCheckError::no_trait_impl_error(
|
let class = if cfg!(feature = "debug") {
|
||||||
|
class.clone()
|
||||||
|
} else {
|
||||||
|
self.deref_tyvar(class.clone(), Variance::Covariant, loc)?
|
||||||
|
};
|
||||||
|
let trait_ = if cfg!(feature = "debug") {
|
||||||
|
trait_.clone()
|
||||||
|
} else {
|
||||||
|
self.deref_tyvar(trait_.clone(), Variance::Covariant, loc)?
|
||||||
|
};
|
||||||
|
Err(TyCheckErrors::from(TyCheckError::no_trait_impl_error(
|
||||||
self.cfg.input.clone(),
|
self.cfg.input.clone(),
|
||||||
line!() as usize,
|
line!() as usize,
|
||||||
class,
|
&class,
|
||||||
trait_,
|
&trait_,
|
||||||
loc,
|
loc,
|
||||||
self.caused_by(),
|
self.caused_by(),
|
||||||
None,
|
None,
|
||||||
))
|
)))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue