Skip to content

Commit b3c9e59

Browse files
committed
Don't eta expand when reading Scala 2 types
Eta expansion needs type parameters which can provoke a cycle. Fixes #12109.
1 parent 104f437 commit b3c9e59

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
788788
OrType(args(0), args(1), soft = false)
789789
}
790790
else if (args.nonEmpty) tycon.safeAppliedTo(EtaExpandIfHK(sym.typeParams, args.map(translateTempPoly)))
791-
else if (sym.typeParams.nonEmpty) tycon.EtaExpand(sym.typeParams)
791+
//else if (sym.typeParams.nonEmpty) tycon.EtaExpand(sym.typeParams)
792792
else tycon
793793
case TYPEBOUNDStpe =>
794794
val lo = readTypeRef()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object JsonReaderDefaultValue extends LowPriorityDefaultValue {
2+
class ReaderDefaultValue extends scala.annotation.StaticAnnotation
3+
}
4+
5+
trait LowPriorityDefaultValue {
6+
@JsonReaderDefaultValue.ReaderDefaultValue
7+
class NoDefaultValue
8+
}

tests/pos/i12109/Test.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
object Test {
2+
JsonReaderDefaultValue
3+
}

0 commit comments

Comments
 (0)