Commit 8e5a1a4a
8e5a1a4af890Merged
Ori Pekelman <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
spinel-doctor: add an inference leg (methods widened to untyped)
A method whose signature spinel widened to untyped runs on the boxed
poly slow path -- correct, but slower, and often the first visible sign
that inference could not pin a concrete type (sometimes the leading edge
of a latent type gap). --emit-rbs already marks each such site with a
# spinel: widened to untyped (slow path) comment; this leg surfaces them
in the one health report instead of requiring a separate --emit-rbs read.
Info severity: it does not affect the exit code (the program is correct),
matching requires. Reuses the existing --emit-rbs path; no new compiler
surface. --only inference / --skip inference work like the other legs.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 8e5a1a4af890
- Parent
- 4058359a8053
tools/doctor.rbmodifiedView file
# build compile to a binary; report compile / codegen / C-build failure# unsupported codegen gaps that degrade to a stub (stderr "unsupported ...")# unresolved calls that silently degrade to nil/0 (SPINEL_WARN_UNRESOLVED)# inference methods spinel widened to untyped (the boxed poly slow path)# requires non-relative `require`s spinel treats as native / no-op# behavior (opt) compiled output vs CRuby; needs `ruby` on PATH quiet = true elsif a == "-h" || a == "--help" puts "usage: spinel-doctor [--only a,b] [--skip a,b] [--behavior] [--quiet] app.rb" puts " legs: build unsupported unresolved requires behavior" puts " legs: build unsupported unresolved inference requires behavior" exit(0) else src = a errs = errs + report("unresolved", "warn", grep_kind(diag, "warning: unresolved"), quiet) end if leg_on("inference", only, skip) # Methods whose signature spinel widened to `untyped` -- the boxed poly # slow path. Each such site is a "# spinel: widened to untyped (slow path)" # comment in --emit-rbs. Not a defect (the program is correct), so it is # info severity and does not affect the exit code; it surfaces where # inference could not pin a concrete type (a perf cost, and sometimes the # first sign of a latent type gap worth a closer look). rbs = tmp_path("doctor", src, ".rbs") sh(sp + " " + src + " --emit-rbs -o " + rbs) widened = [] if File.exist?(rbs) File.read(rbs).split("\n").each { |l| widened.push(l.strip) if l.include?("# spinel: widened") } end report("inference", "info", widened, quiet) end if leg_on("requires", only, skip) reqs = [] File.read(src).split("\n").each { |line|