Skip to content

refactor(semantic,codegen,check): spell qualified names through (*ast.QualifiedName).Text - #1486

Merged
HuiJun merged 1 commit into
developfrom
refactor/qualified-name-text
Oct 25, 2026
Merged

HuiJun merged 1 commit into
developfrom
refactor/qualified-name-text

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What and why

Five places spelled a written qualified name by joining Parts[i].Text with ::, each with its own copy of (*ast.QualifiedName).Text (internal/syntax/ast/namespace.go, nil-safe):

  • qnText in internal/translate/codegen/compile.go (9 call sites across compile*.go) — deleted; callers use qn.Text().
  • qnText in internal/semantic/semantics/filter.go (9 call sites) — deleted; callers use qn.Text().
  • qnText in internal/check/passes/lint_undeclared_signal.go (callers there and in lint_deferred_keeper.go) — deleted; callers use qn.Text(). This copy had no nil guard, so the switch can only remove a crash path.
  • qnText in internal/semantic/resolve/resolver.go — kept, since it also adds the $:: prefix for global names; its += join loop is now qn.Text().
  • semantics.QualifiedNameText, a one-line forwarder to the method whose own doc said new callers should use the method — deleted; its three callers in units.go and modelform/graphs.go use qn.Text(). The modelform qualifiedName wrapper that only re-checked nil around the nil-safe method is inlined too.

Output is identical for every input, nil included, so no diagnostic text or form field changes. Net −49 lines.

How it was verified

$ go build ./...        # clean
$ go vet ./...          # clean
$ gofmt -l .            # (nothing)
$ go test ./...         # all ok except cmd/sysml, which hit go test's 10m default under full-suite load
$ go test -count=1 -timeout 30m ./cmd/sysml
ok  	github.com/Open-MBEE/OpenSysML/cmd/sysml	248.677s
$ python3 scripts/changelog.py check   # clean

Existing tests over the resolver, filter, lint and codegen diagnostics pin the unchanged message text.

Checklist

  • go build, go vet, gofmt -l, go test ./... pass locally
  • Tests added or updated for the change — none needed: a pure consolidation covered by the existing diagnostic tests and TestQualifiedNameText
  • Documentation extended where it already covers the surface — none covers these private helpers
  • Changelog entry added as changes/unreleased/qualified-name-text.changed.md
  • baselines regenerated and make docs-counts run if a gate count moved — no count moved
  • No internal work-item labels in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/38cd7572ebf64b23848f7aedbdfb77cb
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/38cd7572ebf64b23848f7aedbdfb77cb?variant=devin
Requested by: @HuiJun

….QualifiedName).Text

The codegen compiler, the element-filter checker, the undeclared-signal and
deferred-keeper lints and the name resolver each carried a copy of the
method's body; they now call it. The semantics.QualifiedNameText forwarder it
had already superseded is removed, as is the nil guard modelform wrapped
around the nil-safe method. The resolver keeps its $::  prefix for global
names; no diagnostic text changes.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 25, 2026 03:41

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@HuiJun
HuiJun merged commit 1e12fc4 into develop Oct 25, 2026
53 checks passed
@HuiJun
HuiJun deleted the refactor/qualified-name-text branch October 25, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant