Skip to content

Commit c5169f0

Browse files
committed
Reuse existing NameKind to preserve Tasty forward-compatibility
1 parent 7c9a142 commit c5169f0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

compiler/src/dotty/tools/dotc/core/NameKinds.scala

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,18 +290,16 @@ object NameKinds {
290290
*/
291291
val ContextBoundParamName: UniqueNameKind = new UniqueNameKind("evidence$")
292292

293-
/** The name of an inferred contextual function parameter:
294-
*
295-
* val x: A ?=> B = b
296-
*
297-
* becomes:
298-
*
299-
* val x: A ?=> B = (contextual$1: A) ?=> b
300-
*/
301-
val ContextFunctionParamName: UniqueNameKind = new UniqueNameKind("contextual$")
293+
// Reuse an existing NameKind to avoid breaking the tasty readers of Scala 3.3.0 and 3.3.1
294+
// see https://github.com/playframework/playframework/issues/12418
295+
val ContextFunctionParamName: UniqueNameKind = ContextBoundParamName
296+
val CanThrowEvidenceName: UniqueNameKind = ContextBoundParamName
297+
298+
// Generate NameKinds matching the ones used in 3.3.2 so we can unpickle 3.3.2 code.
299+
val ContextFunctionParamName_332: UniqueNameKind = new UniqueNameKind("contextual$")
300+
val CanThrowEvidenceName_332: UniqueNameKind = new UniqueNameKind("canThrow$")
302301

303302
/** Other unique names */
304-
val CanThrowEvidenceName: UniqueNameKind = new UniqueNameKind("canThrow$")
305303
val TempResultName: UniqueNameKind = new UniqueNameKind("ev$")
306304
val DepParamName: UniqueNameKind = new UniqueNameKind("(param)")
307305
val LazyImplicitName: UniqueNameKind = new UniqueNameKind("$_lazy_implicit_$")

0 commit comments

Comments
 (0)