pub enum UfcsVerdict {
FieldCall {
receiver: Ty,
field: String,
field_ty: Ty,
arity_mismatch: Option<UfcsArityMismatch>,
arg_mismatches: Vec<UfcsArgMismatch>,
},
FreeFnAutoRef {
receiver: Ty,
name: String,
target: DefinitionId,
arg_mismatches: Vec<UfcsArgMismatch>,
},
FreeFnDesugar {
receiver: Ty,
name: String,
target: DefinitionId,
arg_mismatches: Vec<UfcsArgMismatch>,
},
PreludeDesugar {
receiver: Ty,
name: String,
arg_mismatches: Vec<UfcsArgMismatch>,
},
}Expand description
What one recv.name(args) call site resolved to (D2’s “node → resolved
target”). Consumed by LIR lowering — which of the two code shapes to
emit — and by IDE hover/go-to-def, which needs the real target rather
than the receiver the ResolutionMap records for the callee path.
Variants§
FieldCall
Field access won (step 2): the receiver’s type declares a function-typed field with the called name, so the call is a call through that field’s value.
Fields
field_ty: TyThe field’s declared type. Always a Ty::Fn — a
non-callable match is E140, never a verdict.
arity_mismatch: Option<UfcsArityMismatch>Issue #1918: this verdict’s own arity fact. Unlike
Self::FreeFnDesugar/Self::FreeFnAutoRef, a field call has
no receiver-prepending desugar — npc.on_greet(3) lowers
straight to lir::ExprKind::CallValue { callee, args } calling the
field’s own fn(...) value with the written arguments only
(brink_ir::lir::lower::expr::lower_ufcs_call’s FieldCall
arm), so a mismatch here is a plain expected/got pair, not a
per-argument UfcsArgMismatch. Computed unconditionally
alongside this verdict, like every other verdict’s own arg-check
fields; reported only by strict mode ([check_strict], E063)
— this verdict is structurally strict::check_value_calls’s T1c
“call through a function value” domain, just reached via field
access, and this reuses that check’s own
ValueCallKind::ArityMismatch wording verbatim. Gradual mode
relies on the runtime FunctionValueArity fault
Opcode::CallValue already raises for every call through a
function value — the same bytecode shape this verdict lowers
to, so arity is enforced there regardless of static policy.
arg_mismatches: Vec<UfcsArgMismatch>Issue #1918: this verdict’s own per-argument type mismatches —
the FieldCall sibling of Self::FreeFnDesugar’s own
arg_mismatches. Differs from that sibling’s index
convention: a field call passes no receiver argument, so
index here is 0-based over the written arguments only —
matching strict::check_value_calls’s own
ValueCallKind::ArgMismatch convention, not
UfcsArgMismatch::index’s “receiver counts as 0” default (see
that field’s own doc for the exception this carves out).
Reported only by strict mode (E063), same gate as
arity_mismatch above.
FreeFnAutoRef
D5 auto-ref (issue #1462): a free function won (step 3) and its
first parameter is declared ref, so the call desugars to
name(ref recv, args) — the receiver spelled as an explicit T1e
ref-argument/projection, so the callee’s writes land in the
receiver’s own cell instead of in a copy.
Only ever recorded for a receiver that can actually be written
through ([UfcsVisitor::auto_ref_fault]); anything else is E143.
Fields
target: DefinitionIdThe definition the desugared call targets.
arg_mismatches: Vec<UfcsArgMismatch>Issue #1881: statically-checkable argument-type mismatches
between the desugared call name(recv, args) and target’s
already-known declared param types, computed unconditionally
alongside this verdict — see UfcsArgMismatch’s own doc.
Reported only by strict mode ([check_strict], E063).
FreeFnDesugar
A free function won (step 3): the call desugars to
name(recv, args), by value.
Fields
target: DefinitionIdThe definition the desugared call targets.
arg_mismatches: Vec<UfcsArgMismatch>Issue #1881: identical posture to Self::FreeFnAutoRef’s own
arg_mismatches field — the by-value desugar shape.
PreludeDesugar
A T1b/NS stdlib prelude name won (step 3, D4’s “file use + prelude”
candidate set): the call desugars to name(recv, args) exactly like
Self::FreeFnDesugar, but the target is a VM-native intrinsic
(resolve::is_t1b_stdlib_name/resolve::is_builtin_function), not an
index symbol — there is no DefinitionId to record. xs.len(),
inventory.push(sword), a.sort_by(c) all land here.
Fields
arg_mismatches: Vec<UfcsArgMismatch>Issue #1919: statically-checkable argument-domain mismatches
between the desugared call name(recv, args) and the verb’s
own container-projected domain (the receiver’s element/key/
value type — a prelude verb has no DefinitionId and so no
declared param list to compare against), computed
unconditionally alongside this verdict — see
[UfcsVisitor::check_ufcs_prelude_arg_types]’s own doc.
Reported only by strict mode ([check_strict], E063), the
same code Self::FreeFnDesugar’s own arg_mismatches uses.
Trait Implementations§
Source§impl Clone for UfcsVerdict
impl Clone for UfcsVerdict
Source§fn clone(&self) -> UfcsVerdict
fn clone(&self) -> UfcsVerdict
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UfcsVerdict
impl Debug for UfcsVerdict
impl Eq for UfcsVerdict
Source§impl PartialEq for UfcsVerdict
impl PartialEq for UfcsVerdict
impl StructuralPartialEq for UfcsVerdict
Auto Trait Implementations§
impl Freeze for UfcsVerdict
impl RefUnwindSafe for UfcsVerdict
impl Send for UfcsVerdict
impl Sync for UfcsVerdict
impl Unpin for UfcsVerdict
impl UnsafeUnpin for UfcsVerdict
impl UnwindSafe for UfcsVerdict
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.