Skip to main content

Module diagnostics

Module diagnostics 

Source
Expand description

Ruby’s semantic diagnostics: proof-gated unresolved-constant reporting.

Every candidate this pass reaches leaves one typed outcome in the SemanticDiagnosticReport: a resolution, a complete absence proof, or a typed reason why absence could not be proven. A candidate is never dropped in silence, and an error is only ever published behind a SemanticAbsenceProof over a surface that was complete.

Unlike Go’s, Python’s and PHP’s, Ruby’s pass routes through the graph semantic index rather than a BoundedDefinitionLookup, so it follows graph::resolver across the crate line rather than being independently movable. analyzer/ruby/diagnostics.rs in brokk-bifrost-analysis keeps the downcast that produces the arguments and implements RubyGemSurface, which is what this crate cannot name: the activated semantic-model overlay and the retained gem-discovery evidence.

§What this pass judges

Exactly one candidate shape: the terminal of an explicit constant path (Widget::Config). Each terminal is checked against two surfaces, the visible workspace closure and the activated gem packs, and reported absent only when the surface that owns it was complete.

§What this pass does not judge, and why

A bare constant (Widget, String) is not a candidate. Ruby’s top-level constant surface includes the core library, everything Object inherits, and whatever every loaded gem defined as a side effect. Bifrost publishes no core Ruby surface, so a miss against the surfaces this pass can see would prove nothing about a name that Ruby itself supplies.

A method is not a candidate either, and this is not a temporary gap. Gem packs publish a gem’s own declarations and nothing above them: there is no published Object, Module, Class, Kernel or BasicObject, and SemanticModelOverlay::universal_root_for_language supplies an implicit root only for Java and Scala. So even a gem whose surface is fully RBS-complete is missing new, name, send, freeze and every other inherited member, and a member miss against it would be a false positive on the very first line of ordinary code (Widget.new). method_missing, define_method, class << self and extend widen the same surface further at run time. Proving a Ruby member absent needs a published core ancestry that does not exist yet, so this pass never asks the question. See #1624.

Structs§

UnacquiredRubyGems
A surface that has acquired nothing. Every boundary is unknown, which is the honest answer for an analyzer no host has activated gem packs on.

Enums§

RubyGemBoundary
What the analyzer’s retained gem evidence proves about one name a Ruby file reaches outside the visible workspace closure.

Constants§

MAX_RUBY_DIAGNOSTIC_VISIBLE_FILES
MAX_RUBY_DIAGNOSTIC_VISIBLE_SOURCE_BYTES
MAX_RUBY_SEMANTIC_DIAGNOSTICS
RUBY_SEMANTIC_DIAGNOSTIC_SOURCE
RUBY_UNRECOGNIZED_SYMBOL

Traits§

RubyGemSurface
The retained gem surface a Ruby diagnostic request may read.

Functions§

collect_ruby_semantic_diagnostics
Collect Ruby semantic diagnostics and the proof or suppression behind each.