Skip to content

Backport "fix: show hover for synthetics if explicitly used" to 3.3 LTS #356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ object MetalsInteractive:
if head.symbol.is(Exported) then
val sym = head.symbol.sourceSymbol
List((sym, sym.info, None))
else if head.symbol.is(Synthetic) then
enclosingSymbolsWithExpressionType(
tail,
pos,
indexed,
skipCheckOnName
)
else if head.symbol != NoSymbol then
if skipCheckOnName ||
MetalsInteractive.isOnName(
Expand All @@ -231,6 +224,13 @@ object MetalsInteractive:
indexed.ctx.source
)
then List((head.symbol, head.typeOpt, None))
else if head.symbol.is(Synthetic) then
enclosingSymbolsWithExpressionType(
tail,
pos,
indexed,
skipCheckOnName
)
/* Type tree for List(1) has an Int type variable, which has span
* but doesn't exist in code.
* https://github.com/lampepfl/dotty/issues/15937
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,16 @@ class HoverTermSuite extends BaseHoverSuite:
"""def ???: Nothing""".stripMargin.hover
)

@Test def `value-of`: Unit =
check(
"""|enum Foo(val key: String) {
| case Bar extends Foo("b")
| case Baz extends Foo("z")
|}
|
|object Foo {
| def parse(key: String) = Foo.va@@lueOf("b")
|
|""".stripMargin,
"def valueOf($name: String): Foo".hover
)