scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.82k stars 1.05k forks source link

Map over refs of `ImportType`s in `TypeMap` #20837

Closed EugeneFlesselle closed 3 months ago

EugeneFlesselle commented 3 months ago

The inliner replaces references to parameters by their corresponding proxys, including in singleton types. It did not handle the mapping over import types, the symbols of which way have depended on parameters.

Both i19493 and i19436 require mapping the type of the expr in an ImportType which is itself the info of a TermRef. In the first issue, for the substitution of an inline def parameter proxy. In the second issue, for the parameter of a lambda returned from an inline def.

Both can be handled in TypeMap by mapping over references to ImportTypes. The second case also requires modifying TreeTypeMap#mapType such that the logic mapping over imports is done within a TypeMap doing the symbol substitutions.

Also note these mappings are only necessary for summonInlines (which could have just been made non-inline) resolving post-inlining to givens imported within the inline definition.

Fix #19493 Fix #19436