Skip to content

Compiler crashes on self invocation with too many argument lists on class that defines apply. #11391

Open
@SrTobi

Description

@SrTobi
class A(i: Int) {
 def this() = this(3)(3)
 def apply(i: Int) = ???
}

crashes with (in ammonite):

Error while emitting cmd0.sc
assertion failed: 
  Cannot emit primitive conversion from V to Lammonite/$sess/cmd0$A; - cmd0.sc
     while compiling: cmd0.sc
        during phase: jvm
     library version: version 2.12.8
    compiler version: version 2.12.8
  reconstructed args: -nowarn -Yresolve-term-conflict:object

  last tree to typer: TypeTree(class Array)
       tree position: line 5 of cmd0.sc
            tree tpe: Array[Object]
              symbol: final class Array in package scala
   symbol definition: final class Array[T] extends Object (a ClassSymbol)
      symbol package: scala
       symbol owners: class Array
           call site: constructor cmd0$A in class cmd0$A in package $sess

== Source file context for tree position ==

     2   def this() = this(3)(3)
     3   def apply(i: Int) = ???
     4 }
     5 def $main() = { ammonite.repl.ReplBridge.value.Internal.combinePrints(
     6       _root_.ammonite
     7             .repl
     8             .ReplBridge
Compilation Failed

Using this(3).apply(3) as well as removing the apply-definition correctly yields a compiler error.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions