pub struct TypedCommons {
pub commons: Commons,
pub types: HashMap<String, Arc<TypeDecl>>,
pub fns: HashMap<String, Arc<FnDecl>>,
pub methods: HashMap<String, MethodTable>,
pub expr_types: HashMap<ExprId, TypedExpr>,
pub callees: HashMap<ExprId, Callee>,
pub warnings: Vec<CompileError>,
pub ty_intern: Arc<Types>,
pub actor_bindings: HashMap<Span, (String, TyId)>,
}Expand description
Output of type checking.
Fields§
§commons: Commons§types: HashMap<String, Arc<TypeDecl>>§fns: HashMap<String, Arc<FnDecl>>§methods: HashMap<String, MethodTable>§expr_types: HashMap<ExprId, TypedExpr>T3.4 (R2.4/R2.5): keyed by ExprId — a node’s identity, not its
position. The value carries its own span alongside ty, so
LSP-facing consumers that need “type at this cursor offset” (a
position-shaped question, asked at the editor boundary, not the
checker’s own identity) can still answer it without a second map.
callees: HashMap<ExprId, Callee>P6.0 (#1139): the call-shaped expressions this unit’s checker
dispatched, classified once here rather than re-derived by
bynk-emit’s lowering (P6.2) or any other later consumer. Mirrors
expr_types exactly — same key, same “recorded during checking, read
afterward” shape.
warnings: Vec<CompileError>v0.89 (ADR 0117): non-failing warnings produced while checking this unit
— surfaced but not gating. Empty unless a warning-category diagnostic
(e.g. bynk.given.unused_capability) fired on an otherwise-clean check.
ty_intern: Arc<Types>T3.6b (R4.1): the intern table every TyId on this unit — in
expr_types, in a Ty node’s own recursive fields — was minted from.
Named ty_intern rather than types only because types above is
already this struct’s declaration table (TypeDecl by name); the two
are unrelated. Rc so RecordCheck can hand the same table out
alongside partial_expr_types on the error path, where no
TypedCommons is built to own it.
actor_bindings: HashMap<Span, (String, TyId)>#1170: a service handler’s own resolved by <binder>: <Actor> actor
binding — handler_actor_binding’s own return value
(context_checks.rs), persisted here rather than discarded once
check_service_decls’s own per-handler loop moves on, the same
“recorded during checking, read afterward” shape callees (above)
already established. Keyed by the handler’s own span: a Handler
has no arena identity of its own (no DefId/ExprId — it is a
declaration, not an expression), and Span is already this
codebase’s established “no arena” substitute for exactly this kind
of identity (Copy/Eq/Hash, already used as a diagnostic anchor
throughout context_checks.rs). No entry for a handler
handler_actor_binding itself resolves to None for: a
binder-less by <Actor> clause, or no by clause at all —
including every agent handler, which cannot carry one
(bynk.actor.by_on_agent). As of P6.11 (#1171),
bynk-emit::ir::lower’s lower_service_handler_ir is the real
consumer that reads this back to build a real service-handler
ActorBinder — lower_handler_ir (agent-only, P6.9, #1167) never
does, deliberately (bynk-emit::ir::IrHandler’s own doc comment).
Unit-wide, not per-file (review of #1170, unlike callees/
expr_types, which are genuinely per-file — keyed by ExprIds this
file’s own checking pass minted): check_service_decls walks
table.services, the whole unit’s own UnitTable, not just this
file’s declarations, so every file of a multi-file context ends up
with the entire unit’s bindings in its own TypedCommons. Harmless
for a by-span lookup (a span is only ever looked up in the file that
actually owns it), but a future consumer that iterates this map
rather than looking up one known span would see sibling files’
handlers too — worth knowing before writing that consumer, not
discovering it by surprise.
Implementations§
Source§impl TypedCommons
impl TypedCommons
Sourcepub fn tys(&self) -> &Arc<Types>
pub fn tys(&self) -> &Arc<Types>
T3.6b (R4.1): this unit’s intern table — what every TyId reachable
from expr_types resolves against.
Returns the Rc handle rather than a bare &Types so a caller that
needs to share the table (the project path, which checks many units
into one ExprTypeSink) can clone it; &Arc<Types> deref-coerces to
&Types everywhere a plain borrow is wanted.
Sourcepub fn expr_ty(&self, id: ExprId) -> Option<Arc<Ty>>
pub fn expr_ty(&self, id: ExprId) -> Option<Arc<Ty>>
The interned node an expression was typed to, resolved in one step.
The reader-side shape bynk-emit/the LSP want: they ask “what shape is
this expression?”, never “which id is it?”. Rc so the resolve is a
refcount bump, and .as_deref() gives back the &Ty these call sites
read before T3.6b.
Sourcepub fn callee(&self, id: ExprId) -> Option<&Callee>
pub fn callee(&self, id: ExprId) -> Option<&Callee>
P6.0 (#1139): the resolved Callee classification for a
call-shaped expression, if this unit’s checker dispatched one at
id. Mirrors Self::expr_ty’s shape.
Sourcepub fn actor_binding(&self, span: Span) -> Option<&(String, TyId)>
pub fn actor_binding(&self, span: Span) -> Option<&(String, TyId)>
#1170: a service handler’s own resolved actor binding, if
handler_actor_binding (context_checks.rs) resolved one for the
handler at span. Mirrors Self::callee’s shape — the single
documented read point for actor_bindings, kept symmetric with
expr_ty/callee rather than leaving every future consumer to
reach into the HashMap directly. Real reader as of P6.11 (#1171):
bynk-emit::ir::lower’s lower_service_handler_ir.
Auto Trait Implementations§
impl Freeze for TypedCommons
impl RefUnwindSafe for TypedCommons
impl Send for TypedCommons
impl Sync for TypedCommons
impl Unpin for TypedCommons
impl UnsafeUnpin for TypedCommons
impl UnwindSafe for TypedCommons
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<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);