Skip to content

Also map types in Implicits.emitDictionary#26143

Open
eejbyfeldt wants to merge 1 commit into
scala:mainfrom
eejbyfeldt:i20448
Open

Also map types in Implicits.emitDictionary#26143
eejbyfeldt wants to merge 1 commit into
scala:mainfrom
eejbyfeldt:i20448

Conversation

@eejbyfeldt
Copy link
Copy Markdown
Contributor

Fixes: #20448

Before the test case would crash with

Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value $_lazy_implicit_$1 (line -1) #15419 when pickling /home/eejbyfeldt/dev/eejbyfeldt/scala_playground/scala3_crash.scala
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:872)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:136)

Because if there were path dependent types the types would not be
updated and still refer to the old symbols.

How much have you relied on LLM-based tools in this contribution?

Extensively, for finding the location in code and writing the fix.

How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)

@eejbyfeldt eejbyfeldt marked this pull request as ready for review May 22, 2026 14:46
@Gedochao Gedochao requested review from odersky and sjrd May 28, 2026 06:53
tpd.ref(vsymMap(id.symbol))(using ctx.withSource(id.source)).withSpan(id.span)
case tree => tree
})
val rhsMap = new TreeTypeMap(
Copy link
Copy Markdown
Contributor

@odersky odersky May 30, 2026

Choose a reason for hiding this comment

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

The logic is fine, but I think we can remove duplication. Make a specialized TreeTypeMap class that's parameterized by two functions TermRef => Type and Ident => Term that implement the relevant cases for Termrefs/Idents that are vsymMap keys.

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.

Great suggestion! Updated the PR with a new helper.

Fixes: scala#20448

Before the test case would crash with
```
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value $_lazy_implicit_$1 (line -1) scala#15419 when pickling /home/eejbyfeldt/dev/eejbyfeldt/scala_playground/scala3_crash.scala
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:872)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:136)
```
Because if there were path dependent types the types would not be
updated and still refer to the old symbols.
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.

by name implicits results in compiler crash unresolved symbols: value $_lazy_implicit_$1

2 participants