Crystal: BUG: trying to upcast (Proc(Nil) | Nil) <- (Proc(String) | Nil) (Exception)

Created on 3 Nov 2019  路  2Comments  路  Source: crystal-lang/crystal

Here's code that causes a compiler exception:

def create_proc(b : String)

  if true
    begin
       ->(){""}
    rescue
      return ->(){}
    end
  end
end

create_proc "X"

(Also on https://play.crystal-lang.org/#/r/7y27 )

I was able to trigger this issue only in this somewhat narrow set of conditions -- an if, with a begin block, with the begin part not having return, while rescue do having it, and with the proc signature being different.

bug compiler

Most helpful comment

Let's add the example as a spec.

All 2 comments

Appears to be fixed : https://carc.in/#/r/990k

Let's add the example as a spec.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

costajob picture costajob  路  3Comments

will picture will  路  3Comments

lbguilherme picture lbguilherme  路  3Comments

relonger picture relonger  路  3Comments

ArthurZ picture ArthurZ  路  3Comments