Report S0015 split-port errors at the interface field's declaration#1053
Open
nanavati wants to merge 1 commit into
Open
Report S0015 split-port errors at the interface field's declaration#1053nanavati wants to merge 1 commit into
nanavati wants to merge 1 commit into
Conversation
The Prelude's port-name checks (checkPortNames and the excess-arg_names case of methodArgBaseNames) report primError at getEvalPosition of a (_ :: m) type proxy, and that position is only ever recovered from Ids embedded in the proxy's TYPE -- the method type's tycons. So S0015 pointed at a type mentioned in the field's signature (e.g. Foo at 17:12), not at the field the user declared. Report a term-side position instead. GenWrap already passes each WrapField call a StrArg name proxy; build that proxy as a raw undefined stamped with the interface field's decl-side position (mkStrArgProxyExpr) instead of a plain don't-care, whose class-dispatched undefined construction rebuilds the nullary StrArg constructor and loses the position. The Prelude's WrapField instance takes getEvalPosition of that proxy and threads a Position__ through the WrapMethod port-check methods (methodArgBaseNames, inputPortNames, outputPortNames, saveMethodPortTypes) into checkPortNames and the excess-arg_names primError. The noinline path (fromWrapNoInline) uses the position of its name string literal, which GenFuncWrap stamps with the function's def position. The errors now point at the interface field being checked (its decl Id): BadSplitInst_TooManyPortNames.bs 17:2 (was the type use at 17:12) and TooManyArgNames.bs 27:2 (was 27:29). Regold the two expected files accordingly. Validated: build green; bsc.verilog/splitports localcheck fully green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vjo7EmAfHvZTWPDJ923FVz
This was referenced Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Prelude's split-port checks (
checkPortNames, the excess-arg_namescase ofmethodArgBaseNames) reported S0015primErrors atgetEvalPositionof a(_ :: m)proxy — a position only ever recovered from Ids embedded in the proxy's type (the
method type's tycons) via
getIExprPosition's type fallback. So the error blamed anincidental type use site, e.g.
BadSplitInst_TooManyPortNames.bs:17:12.Replace the type-side leak with a term-side source. GenWrap already passes each
WrapFieldcall aStrArgname proxy; build it as a raw undefined stamped with theinterface field's decl position (
mkStrArgProxyExpr) instead of a plain don't-care(whose class-dispatched construction rebuilds the nullary
StrArgconstructor and losesthe position). The Prelude's
WrapFieldinstance takesgetEvalPositionof that proxyand threads a
Position__through theWrapMethodport-check methods(
methodArgBaseNames,inputPortNames,outputPortNames,saveMethodPortTypes) intocheckPortNames. The noinline path (fromWrapNoInline) uses the position of its namestring literal, which GenFuncWrap stamps with the function's def position.
The errors now point at the interface field being checked: 17:2 / 27:2 instead of
17:12 / 27:29. Two expected files regolded.
Why
Diagnostics improvement on its own — the field declaration is what the check is about.
It also removes the last S0015 dependence on positions carried inside type-embedded Ids:
the IType interning stack (#1048) strips those positions, and without this change the
errors degrade to "Unknown position".
Validation
bsc.verilog/splitports localcheck fully green (317 passes), plus bsc.bluetcl/commands
and bsc.typechecker/dontcare spot checks, all under the interning stack's checked build;
the full stack records fullparallel 20281/0/134.
Stack
Standalone on main. One of four independent fixes (#1051 (ATF canonical ids), #1052 (listcons SDataCon sort), #1053 (this), #1054 (CIclass sort members)) below the reworked #1048.