Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
docelic opened this issue Nov 3, 2019 · 3 comments · Fixed by #10073
Closed

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

docelic opened this issue Nov 3, 2019 · 3 comments · Fixed by #10073
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler

Comments

@docelic
Copy link
Contributor

docelic commented Nov 3, 2019

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.

@jhass jhass added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler labels Nov 3, 2019
@rmarronnier
Copy link

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

@jhass
Copy link
Member

jhass commented Jun 11, 2020

Let's add the example as a spec.

@straight-shoota straight-shoota linked a pull request Dec 11, 2020 that will close this issue
@docelic
Copy link
Contributor Author

docelic commented Nov 5, 2021

The issue reported in this ticket has been solved some 1.5 years ago.
The suggestion was to also add a test before closing this ticket, to make sure that the error doesn't come back at some later point.

But, I was unable to come up with a fully working test myself (#10073), and asking for help from others wasn't successful.
So, closing this ticket since obviously nothing else is going to happen.

@docelic docelic closed this as completed Nov 5, 2021
straight-shoota pushed a commit that referenced this issue Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants