Skip to content

Commit a88ed69

Browse files
oderskymichelou
authored andcommitted
Don't eta expand when reading Scala 2 types
Eta expansion needs type parameters which can provoke a cycle. Fixes scala#12109.
1 parent d2ec783 commit a88ed69

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
@@ -792,7 +792,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
792792
OrType(args(0), args(1), soft = false)
793793
}
794794
else if (args.nonEmpty) tycon.safeAppliedTo(EtaExpandIfHK(sym.typeParams, args.map(translateTempPoly)))
795-
else if (sym.typeParams.nonEmpty) tycon.EtaExpand(sym.typeParams)
795+
//else if (sym.typeParams.nonEmpty) tycon.EtaExpand(sym.typeParams)
796796
else tycon
797797
case TYPEBOUNDStpe =>
798798
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)