Fix companion object name being doubled in search results#15
Merged
Conversation
Module val symbols (companion objects) were printing both the term name and their declared type (a TypeRef to the module class), producing output like "object LoggerSupportLoggerSupport$". Skip the type signature for module vals since "object Name" is sufficient. Fixes #11 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes incorrect signature printing for companion objects (module val TermSymbols) in search/get output by avoiding appending the module class type (which previously produced duplicated names like object LoggerSupportLoggerSupport$).
Changes:
- Update
TypePrinter.printSymbolSignatureto skipdeclaredTyperendering forterm.isModuleVal. - Preserve existing signature rendering for non-module term symbols.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
95
to
+99
| val keyword = termKeyword(term) | ||
| val sig = printMethodic(term.declaredType) | ||
| s"$keyword ${term.name}$sig" | ||
| if term.isModuleVal then s"$keyword ${term.name}" | ||
| else | ||
| val sig = printMethodic(term.declaredType) | ||
| s"$keyword ${term.name}$sig" |
There was a problem hiding this comment.
The new behavior for TermSymbol module vals (skipping the declared type signature) isn’t covered by tests. Consider adding a TypePrinterTest case that resolves an object via ctx.findStaticTerm(...) (module val) and asserts the signature prints as object <Name> and does not include the module class type (e.g., no trailing $).
Test that printSymbolSignature for a companion object term symbol produces "object CellarTC" without doubling the name, and that the module class variant starts with "object". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Module val symbols (companion objects) were printing both the term name
and their declared type (a TypeRef to the module class), producing
output like "object LoggerSupportLoggerSupport$". Skip the type
signature for module vals since "object Name" is sufficient.
Fixes #11
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com