From 545917ef929053a011dac3db7c541dbf2362d767 Mon Sep 17 00:00:00 2001 From: noti0na1 Date: Thu, 22 May 2025 13:36:07 +0200 Subject: [PATCH 1/3] Try to handle SkolemTypes in SingletonTypeTree during pickling [Cherry-picked 1f839bb2bacade9abcfc6329e94eabb388870423] --- .../src/dotty/tools/dotc/core/tasty/TreePickler.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 75fcaaf544a3..0ebe67834b36 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -630,8 +630,13 @@ class TreePickler(pickler: TastyPickler) { case tree: TypeTree => pickleType(tree.tpe) case SingletonTypeTree(ref) => - writeByte(SINGLETONtpt) - pickleTree(ref) + val tp = ref.tpe + val tp1 = tp.deskolemized + if tp1 ne tp then + pickleType(tp1) + else + writeByte(SINGLETONtpt) + pickleTree(ref) case RefinedTypeTree(parent, refinements) => if (refinements.isEmpty) pickleTree(parent) else { From 79f047a9f75b1d2751fa59cf65073776c3c93f42 Mon Sep 17 00:00:00 2001 From: noti0na1 Date: Thu, 22 May 2025 13:48:00 +0200 Subject: [PATCH 2/3] Add test [Cherry-picked 23c094edde7b07c4793b1373637dcd940e4a4ced] --- tests/pos/i23194.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/pos/i23194.scala diff --git a/tests/pos/i23194.scala b/tests/pos/i23194.scala new file mode 100644 index 000000000000..347b98efd877 --- /dev/null +++ b/tests/pos/i23194.scala @@ -0,0 +1,14 @@ +class R[T] extends annotation.StaticAnnotation + +class A[T]: + val next: A[T] = null + val self: this.type = this + val selfnext: this.next.type = this.next + def f: (A[T] @R[this.type], A[T] @R[this.next.type]) = ??? + def g: (A[T] @R[self.type], A[T] @R[selfnext.type]) = ??? + +class Test: + def test = + val (a, b) = A[String]().f + val (a2, b2) = A[String]().g + \ No newline at end of file From ce21145c1372e1d9429d59d895775308b4c22720 Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Mon, 26 May 2025 16:15:33 +0200 Subject: [PATCH 3/3] bugfix: Fix issues with tests --- compiler/src/dotty/tools/dotc/config/ScalaSettings.scala | 3 ++- tests/neg/indentRight.scala | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 075ea2423f86..4e544718645b 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -37,7 +37,8 @@ object ScalaSettings: ScalaRelease.values.toList.map(_.show) def supportedSourceVersions: List[String] = - SourceVersion.values.toList.map(_.toString) + SourceVersion.values.diff(SourceVersion.illegalInSettings) + .map(_.toString).toList def defaultClasspath: String = sys.env.getOrElse("CLASSPATH", ".") diff --git a/tests/neg/indentRight.scala b/tests/neg/indentRight.scala index 8eb9deb23389..e76c83a02c23 100644 --- a/tests/neg/indentRight.scala +++ b/tests/neg/indentRight.scala @@ -24,8 +24,8 @@ object Test { } trait A - case class B() extends A // error: Line is indented too far to the right - case object C extends A // error: Line is indented too far to the right + case class B() extends A + case object C extends A if (true) // OK println("hi")