Skip to content

Commit

Permalink
Merge pull request #325 from scala-native/topic/nothing-ptr
Browse files Browse the repository at this point in the history
Fix overly restrictive check in NothingLowering
  • Loading branch information
densh committed Oct 12, 2016
2 parents 701927f + 3b1e813 commit 1fc82f2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class NothingLowering extends Pass {
case Block(n, params, insts, cf) =>
val ninsts = mutable.UnrolledBuffer.empty[Inst]
var ncf = cf

breakable {
insts.foreach {
case inst @ Inst(n, call: Op.Call) if call.resty == Type.Nothing =>
Expand All @@ -27,13 +28,14 @@ class NothingLowering extends Pass {
ninsts += inst
}
}

Seq(Block(n, params, ninsts.toSeq, ncf))
}

override def preType = {
case Type.Nothing =>
unsupported(
"nothing can only be used as the result type of the function")
Type.Ptr

case Type.Function(params, Type.Nothing) =>
Type.Function(params, Type.Void)
}
Expand Down

0 comments on commit 1fc82f2

Please sign in to comment.