Skip to content

When unpickling from Tasty, we cannot distinguish between overloaded alternatives with the same signature #7022

Closed
@smarter

Description

@smarter

This code compiles fine:

trait P[A] {
  def foo[T](x: Int): A = ???
}

class C extends P[Int] {
  def foo(x: Int): Int = x
}

object Test {
  def test(p: C): Unit = {
    p.foo(1)
  }
}

But if we run it through the pickler/unpickler (easiest way is to do dotc -Ythrough-tasty Test.scala), we get:

-- Error: /home/smarter/opt/dotty/try/tt.scala:9:4 -----------------------------
9 |    p.foo(1)
  |    ^^^^^^^
  |    overloaded alternatives of method foo in class C with types
  |     (x: Int): Int
  |     [T](x: Int): Int does not take parameters

The problem is that in Tasty, we use this representation:

SELECT 32 [foo[Signed Signature(List(scala.Int),scala.Int)]]

This uses the denotation signature and not the symbol signature, so both alternatives have the same signature.
Fixing this is necessary to switch to the 2.13 collections.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions