Struct erg_compiler::context::eval::SubstContext
source · [−]pub struct SubstContext<'c> { /* private fields */ }
Expand description
Instantiate the polymorphic type from the quantified state.
e.g.
SubstContext::new(Array(?T, 0), ...) => SubstContext{ params: { 'T: ?T; 'N: 0 }, ... }
self.substitute(Array!('T; !'N)): Array(?T, !0)
Implementations
sourceimpl<'c> SubstContext<'c>
impl<'c> SubstContext<'c>
sourcepub fn new(substituted: &Type, ctx: &'c Context, loc: Location) -> Self
pub fn new(substituted: &Type, ctx: &'c Context, loc: Location) -> Self
substituted
is used to obtain real argument information. So it must be instantiated as Array(?T, 0)
and so on.
ctx
is used to obtain information on the names and variance of the parameters.
pub fn substitute(&self, quant_t: Type) -> TyCheckResult<Type>
Trait Implementations
sourceimpl<'c> Debug for SubstContext<'c>
impl<'c> Debug for SubstContext<'c>
Auto Trait Implementations
impl<'c> !RefUnwindSafe for SubstContext<'c>
impl<'c> !Send for SubstContext<'c>
impl<'c> !Sync for SubstContext<'c>
impl<'c> Unpin for SubstContext<'c>
impl<'c> !UnwindSafe for SubstContext<'c>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more