Repository navigation
refactor(semantic,codegen,check): spell qualified names through (*ast.QualifiedName).Text - #1486
Merged
Merged
Conversation
….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>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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 and why
Five places spelled a written qualified name by joining
Parts[i].Textwith::, each with its own copy of(*ast.QualifiedName).Text(internal/syntax/ast/namespace.go, nil-safe):qnTextininternal/translate/codegen/compile.go(9 call sites acrosscompile*.go) — deleted; callers useqn.Text().qnTextininternal/semantic/semantics/filter.go(9 call sites) — deleted; callers useqn.Text().qnTextininternal/check/passes/lint_undeclared_signal.go(callers there and inlint_deferred_keeper.go) — deleted; callers useqn.Text(). This copy had no nil guard, so the switch can only remove a crash path.qnTextininternal/semantic/resolve/resolver.go— kept, since it also adds the$::prefix for global names; its+=join loop is nowqn.Text().semantics.QualifiedNameText, a one-line forwarder to the method whose own doc said new callers should use the method — deleted; its three callers inunits.goandmodelform/graphs.gouseqn.Text(). The modelformqualifiedNamewrapper 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
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 locallyTestQualifiedNameTextchanges/unreleased/qualified-name-text.changed.mdmake docs-countsrun if a gate count moved — no count movedLink 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