Skip to content

Optimization after Polymorphism Boxing crashes the compiler #1012

Open
@phischu

Description

@phischu

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)
....

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions