Skip to content

Backport "Fix #23194: Try to handle SkolemTypes in SingletonTypeTree during pickling" to 3.3 LTS #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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", ".")

Expand Down
9 changes: 7 additions & 2 deletions compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions tests/neg/indentRight.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i23194.scala
Original file line number Diff line number Diff line change
@@ -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

Loading