Skip to content

Compile crush: Dependent Method Types and Varargs #23299

Closed
@eanea

Description

@eanea

Compiler version

3.3.5
3.6.4
3.7.0-RC1

Minimized code

def kek(t: Table, ids: t.Id*) = ???

trait Table {
  type Id = String
}

object Table1 extends Table {
  val id: Id = "table1_id"
}

kek(Table1, Table1.id)

https://scastie.scala-lang.org/hqos1NfBRCWm4jbmhqhmHQ

Output (click arrow to expand)

error when pickling type t.type
error when pickling type t.Id
error when pickling tree t.Id
error when pickling tree [Playground.Table1.id : t.Id]
error when pickling tree [Playground.Table1.id : t.Id]*
error when pickling tree Playground.kek(Playground.Table1, [Playground.Table1.id : t.Id]*)
error when pickling tree val $t: Nothing =
  Playground.kek(Playground.Table1, [Playground.Table1.id : t.Id]*)
error when pickling tree {
  val $t: Nothing =
    Playground.kek(Playground.Table1, [Playground.Table1.id : t.Id]*)
  Playground.instrumentationMap.update(
    _root_.com.olegych.scastie.api.Position.apply(133, 155),
    _root_.com.olegych.scastie.api.runtime.Runtime.render[Any]($t))
  $t:Nothing
}
error when pickling tree scala.Predef.locally[Nothing](
  {
    val $t: Nothing =
      Playground.kek(Playground.Table1, [Playground.Table1.id : t.Id]*)
    Playground.instrumentationMap.update(
      _root_.com.olegych.scastie.api.Position.apply(133, 155),
      _root_.com.olegych.scastie.api.runtime.Runtime.render[Any]($t))
    $t:Nothing
  }
)
error when pickling tree () extends Object(), com.olegych.scastie.api.runtime.ScastieApp {
  this: Playground.type =>
  private def writeReplace(): AnyRef =
    new scala.runtime.ModuleSerializationProxy(classOf[Playground.type])
  private[this] val instrumentationMap:
    
      scala.collection.mutable.Map[com.olegych.scastie.api.Position,
        com.olegych.scastie.api.Render]
    
   =
    _root_.scala.collection.mutable.Map.empty[
      _root_.com.olegych.scastie.api.Position,
      _root_.com.olegych.scastie.api.Render]
  def instrumentations: List[com.olegych.scastie.api.Instrumentation] =
    Playground.instrumentationMap.toList.map[
      com.olegych.scastie.api.Instrumentation](
      {
        def $anonfun(
          x$1:
            (com.olegych.scastie.api.Position, com.olegych.scastie.api.Render)
        ): com.olegych.scastie.api.Instrumentation =
          x$1 match 
            {
              case 
                Tuple2.unapply[com.olegych.scastie.api.Position,
                  com.olegych.scastie.api.Render](pos @ _, r @ _)
               =>
                _root_.com.olegych.scastie.api.Instrumentation.apply(pos, r)
            }
        closure($anonfun)
      }
    )
  def kek(t: Playground.Table, ids: Seq[t.Id] @Repeated): Nothing = ???
  trait Table() extends Object {
    type Id = String
  }
  final lazy module val Table1: Playground.Table1 = new Playground.Table1()
  final module class Table1() extends Object(), Playground.Table {
    this: Playground.Table1.type =>
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Playground.Table1.type]
        )
    val id: Playground.Table1.Id = "table1_id"
  }
  scala.Predef.locally[Nothing](
    {
      val $t: Nothing =
        Playground.kek(Playground.Table1, [Playground.Table1.id : t.Id]*)
      Playground.instrumentationMap.update(
        _root_.com.olegych.scastie.api.Position.apply(133, 155),
        _root_.com.olegych.scastie.api.runtime.Runtime.render[Any]($t))
      $t:Nothing
    }
  )
}
error when pickling tree @SourceFile("src/main/scala/main.scala") final module class Playground() extends
   Object(), com.olegych.scastie.api.runtime.ScastieApp {
  this: Playground.type =>
  private def writeReplace(): AnyRef =
    new scala.runtime.ModuleSerializationProxy(classOf[Playground.type])
  private[this] val instrumentationMap:
    
      scala.collection.mutable.Map[com.olegych.scastie.api.Position,
        com.olegych.scastie.api.Render]
    
   =
    _root_.scala.collection.mutable.Map.empty[
      _root_.com.olegych.scastie.api.Position,
      _root_.com.olegych.scastie.api.Render]
  def instrumentations: List[com.olegych.scastie.api.Instrumentation] =
    Playground.instrumentationMap.toList.map[
      com.olegych.scastie.api.Instrumentation](
      {
        def $anonfun(
          x$1:
            (com.olegych.scastie.api.Position, com.olegych.scastie.api.Render)
        ): com.olegych.scastie.api.Instrumentation =
          x$1 match 
            {
              case 
                Tuple2.unapply[com.olegych.scastie.api.Position,
                  com.olegych.scastie.api.Render](pos @ _, r @ _)
               =>
                _root_.com.olegych.scastie.api.Instrumentation.apply(pos, r)
            }
        closure($anonfun)
      }
    )
  def kek(t: Playground.Table, ids: Seq[t.Id] @Repeated): Nothing = ???
  trait Table() extends Object {
    type Id = String
  }
  final lazy module val Table1: Playground.Table1 = new Playground.Table1()
  final module class Table1() extends Object(), Playground.Table {
    this: Playground.Table1.type =>
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Playground.Table1.type]
        )
    val id: Playground.Table1.Id = "table1_id"
  }
  scala.Predef.locally[Nothing](
    {
      val $t: Nothing =
        Playground.kek(Playground.Table1, [Playground.Table1.id : t.Id]*)
      Playground.instrumentationMap.update(
        _root_.com.olegych.scastie.api.Position.apply(133, 155),
        _root_.com.olegych.scastie.api.runtime.Runtime.render[Any]($t))
      $t:Nothing
    }
  )
}
error when pickling tree package <empty> {
  import _root_.com.olegych.scastie.api.runtime.*
  final lazy module val Playground: Playground = new Playground()
  @SourceFile("src/main/scala/main.scala") final module class Playground()
     extends Object(), com.olegych.scastie.api.runtime.ScastieApp {
    this: Playground.type =>
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Playground.type])
    private[this] val instrumentationMap:
      
        scala.collection.mutable.Map[com.olegych.scastie.api.Position,
          com.olegych.scastie.api.Render]
      
     =
      _root_.scala.collection.mutable.Map.empty[
        _root_.com.olegych.scastie.api.Position,
        _root_.com.olegych.scastie.api.Render]
    def instrumentations: List[com.olegych.scastie.api.Instrumentation] =
      Playground.instrumentationMap.toList.map[
        com.olegych.scastie.api.Instrumentation](
        {
          def $anonfun(
            x$1:
              (com.olegych.scastie.api.Position, com.olegych.scastie.api.Render)
            ): com.olegych.scastie.api.Instrumentation =
            x$1 match 
              {
                case 
                  Tuple2.unapply[com.olegych.scastie.api.Position,
                    com.olegych.scastie.api.Render](pos @ _, r @ _)
                 =>
                  _root_.com.olegych.scastie.api.Instrumentation.apply(pos, r)
              }
          closure($anonfun)
        }
      )
    def kek(t: Playground.Table, ids: Seq[t.Id] @Repeated): Nothing = ???
    trait Table() extends Object {
      type Id = String
    }
    final lazy module val Table1: Playground.Table1 = new Playground.Table1()
    final module class Table1() extends Object(), Playground.Table {
      this: Playground.Table1.type =>
      private def writeReplace(): AnyRef =
        new scala.runtime.ModuleSerializationProxy(
          classOf[Playground.Table1.type])
      val id: Playground.Table1.Id = "table1_id"
    }
    scala.Predef.locally[Nothing](
      {
        val $t: Nothing =
          Playground.kek(Playground.Table1, [Playground.Table1.id : t.Id]*)
        Playground.instrumentationMap.update(
          _root_.com.olegych.scastie.api.Position.apply(133, 155),
          _root_.com.olegych.scastie.api.runtime.Runtime.render[Any]($t))
        $t:Nothing
      }
    )
  }
}

  unhandled exception while running pickler on

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions