You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
engine: unit inference errors are not attached to any variable #837
When unit inference finds a conflict, the engine reports one model-level warning that names the variables involved but is attached to none of them.
So the diagram cannot underline any variable's equation or units field for an inference error; it only shows the message.
Inference errors should also be attached to the variables they involve.
The warning reads "the units of 'a', 'b' are inconsistent with each other; check the equations and declared units of these variables" (plus a count when there are several conflicts), and nothing is underlined in a or b.
Why it matters
The modeler has to find the offending equation by hand.
C-LEARN gets one of these warnings.
Low urgency: the message already names the variables.
Fix
Keep the single model-level warning: macro-heavy models can produce hundreds of conflicts, and one diagnostic per conflict would flood the list.
Add, alongside it, one diagnostic per involved variable for the first conflict (or per distinct variable across all conflicts, capped), each carrying that variable's own location.
The conflict already carries a location for each involved variable.
One trap: a diagnostic's location for an inference error is taken from the first involved variable, which may not be the variable the diagnostic is attached to.
Today nothing exposes this because the warning is attached to no variable, but per-variable diagnostics must use the location of their own variable.
Pointers
src/simlin-engine/src/db/units.rs (the has_declared_units && !inference.conflicts.is_empty() block)
src/simlin-engine/src/diagnostic.rs (DiagnosticError::location, the InferenceError arm uses sources.first())
src/diagram/equation-highlight.ts (currently underlines nothing for inference errors)
changed the title [-]engine: per-source fan-out of unit inference diagnostics (enables per-field underlines deferred from #836)[/-][+]engine: unit inference errors are not attached to any variable[/+]on Oct 12, 2026
Activity
diagram: three-valued unit-error kind; plain-language inference text (#…
[-]engine: per-source fan-out of unit inference diagnostics (enables per-field underlines deferred from #836)[/-][+]engine: unit inference errors are not attached to any variable[/+]