pub struct PolyType { /* private fields */ }Expand description
A type scheme: a monomorphic body plus the set of that body’s free variables which are quantified over it.
Deviation from v0.0.6: v0.0.6 (types.cppo.ml:351-364) converts a
generalized variable’s MonoFree cell into a PolyBound id, so the
same physical type reads differently as “a mono type” vs “a poly type”,
and instantiating rebuilds PolyBound occurrences into fresh
MonoFree cells. This port instead keeps quantified variables as
ordinary (still-Free) TyVarRef/RowVarRef cells and just remembers
which ones they are (vars/row_vars below); instantiate deep-copies
body, replacing each remembered variable (by pointer identity) with a
fresh one and leaving everything else shared untouched. This is the
standard “generalization via levels” technique, and it replaces
v0.0.6’s quantifiability flag (Quantifiable/Unquantifiable,
types.cppo.ml:54) — which guards against generalizing a variable
unification already linked outside the current let binding — with a
consequence of levels instead: a variable unification touches from an
outer scope gets its level lowered (unify::occurs_var/
occurs_var_in_row), so by the time generalize runs it no longer
looks “deep enough” to quantify.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PolyType
impl !Send for PolyType
impl !Sync for PolyType
impl !UnwindSafe for PolyType
impl Freeze for PolyType
impl Unpin for PolyType
impl UnsafeUnpin for PolyType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more