effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Optimization after Polymorphism Boxing crashes the compiler

Open phischu opened this issue 7 months ago • 0 comments

The following program:

def f(x: Int) : Int = { 
  1
}

def use { g: (Int) => Int } : Int = {
  2
}

def main() : Unit = {
  list::map([f]) { y => use {y} }
  println("hi")
}

when compiled with --backend=llvm crashes the compiler with

(unbox v_coe_3743)
[error] java.lang.RuntimeException: Got Var(A), which is not a boxed block type.
[error] 	at scala.sys.package$.error(package.scala:27)
[error] 	at effekt.core.Type$.inferType(Type.scala:183)
[error] 	at effekt.core.Block.<init>(Tree.scala:224)
[error] 	at effekt.core.Block$Unbox.<init>(Tree.scala:221)
[error] 	at effekt.core.Block$Unbox$.apply(Tree.scala:221)
[error] 	at effekt.core.substitutions$.substitute(Tree.scala:773)
....

phischu avatar May 21 '25 15:05 phischu