Repository navigation
refactor(semantic): take the last segment of a qualified name through symbols.LastSegment everywhere - #1496
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
refactor(semantic): take the last segment of a qualified name through symbols.LastSegment everywhere#1496devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
… symbols.LastSegment everywhere Delete the private copies (leafName, lastSegment, simpleName, lastName, leafOf, splitLastSegment and the inline strings.LastIndex splits) in the semantics, solve, runtime, view, passes, grpc, lsp, model and REPL repository packages and call symbols.LastSegment at every site. The output is identical: lastSeparator finds the same index strings.LastIndex does. 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)".
|
…ent-helpers Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # internal/semantic/semantics/filter.go
This branch has not been deployed
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
symbols.LastSegment(internal/semantic/symbols/index.go) already returns the text after the last::of a qualified name. Nine packages above it carried a private copy of the same function under one name or another —leafName(semantics, solve, lsp, model),lastSegment(semantics, solve, passes),simpleName(semantics, view, a solve test),lastName(view),leafOf(passes),splitLastSegment(grpc, whose one caller discarded the parent half) — plus inlinestrings.LastIndex(…, "::")splits insolve/pin.go,runtime/random_functions.goandreplext/repository. This PR deletes every copy and routes each call site (about 60) throughsymbols.LastSegment.Output is unchanged:
lastSeparatorscans right to left for the first::pair, which is the indexstrings.LastIndex(s, "::")returns, and both forms return the input untouched when there is no separator. The three packages that did not already importsymbols(frontend/grpc,ir/view,exec/runtime,replext/repository) sit above it in the layer order, so no import cycle is introduced.Out of scope and deliberately untouched:
internal/exec/runtime/signal.golastSegment(splits on., a different operation),tools/census/metaclassmap/analyze.golastNameandtools/referee/xpect/exported.goleafOf(thetoolsmodule).How it was verified
No tests were deleted or weakened; the test-only
simpleNameininternal/exec/solve/differential_test.gonow callssymbols.LastSegmentdirectly, and thecollection_test.goassertions insemanticsdo the same.Every package passed except five that hit Go's default 10 m per-package timeout under full-suite load on this machine (
cmd/sysml,internal/exec/runtime,internal/exec/smt,tests/codegen,tests/wasm:panic: test timed out after 10m0s). Re-run alone and sequentially with-count=1 -timeout 60m:Checklist
go build ./...,go vet ./...,gofmt -l .andgo test ./...pass locally (see above)symbols.LastSegment; no new behaviour to pin)changes/unreleased/last-segment-helper.changed.mdmake docs-countsrun if a gate count moved (no gate count moved)Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/21d49a5a84a4479cacb0cdea1b07b415
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/21d49a5a84a4479cacb0cdea1b07b415?variant=devin
Requested by: @HuiJun