Skip to content

Commit c14eadc

Browse files
authored
Merge pull request #8288 from soronpo/pickling
Fixes #8287 by simplifying the pickled folded constant presentation via homogenize
2 parents 6beb2f4 + 5d1064e commit c14eadc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ class PlainPrinter(_ctx: Context) extends Printer {
6161
homogenize(tp.info)
6262
case tp: LazyRef =>
6363
homogenize(tp.ref)
64-
case AppliedType(tycon, args) =>
65-
tycon.dealias.appliedTo(args)
64+
case tp @ AppliedType(tycon, args) =>
65+
if (defn.isCompiletimeAppliedType(tycon.typeSymbol)) tp.tryCompiletimeConstantFold
66+
else tycon.dealias.appliedTo(args)
6667
case _ =>
6768
tp
6869
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import scala.compiletime.ops.int._
2+
import scala.annotation.infix
3+
4+
object Test {
5+
class Vec[S <: Int] {
6+
@infix def concat [RS <: Int](that : Vec[RS]) : Vec[S + RS] = new Vec[S + RS]
7+
}
8+
9+
val v1 = new Vec[1]
10+
val v2 = new Vec[2]
11+
val v3 : Vec[3] = v1 concat v2
12+
val v3a = v1 concat v2
13+
val v3b : Vec[3] = v3a
14+
}

0 commit comments

Comments
 (0)