Skip to content

Commit

Permalink
Avoid class cast exception
Browse files Browse the repository at this point in the history
  • Loading branch information
phischu committed Nov 24, 2023
1 parent d2e089b commit 176fd62
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions effekt/shared/src/main/scala/effekt/core/Type.scala
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,21 @@ object Type {

BlockType.Function(tparams, cparams, vparams, bparams, body.tpe)
case Block.Member(b, field, tpe) => tpe
case Block.Unbox(pure) => pure.tpe.asInstanceOf[ValueType.Boxed].tpe
case Block.Unbox(pure) => pure.tpe match {
case List(tpe) => tpe.asInstanceOf[ValueType.Boxed].tpe
case _ => ??? // TODO MRV
}
case Block.New(impl) => impl.tpe
}
def inferCapt(block: Block): Captures = block match {
case Block.BlockVar(id, tpe, capt) => capt
case Block.BlockLit(tparams, cparams, vparams, bparams, body) =>
body.capt -- cparams
case Block.Member(block, field, tpe) => block.capt
case Block.Unbox(pure) => pure.tpe.asInstanceOf[ValueType.Boxed].capt
case Block.Unbox(pure) => pure.tpe match {
case List(tpe) => tpe.asInstanceOf[ValueType.Boxed].capt
case _ => ??? // TODO MRV
}
case Block.New(impl) => impl.capt
}

Expand Down

0 comments on commit 176fd62

Please sign in to comment.