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

Compiler: fixed is_a? transform may cause an exception #4390

Conversation

rockwyc992
Copy link
Contributor

Fixed #4364

Something.some_method.is_a?(Const)

This code may trigger an exception about enclosing call.
This will be transformed to below:

Const === Something.some_method

The compiler checks enclosing call of Something.some_method twice, and causes an exception.
So, cloning the ASTNode could solve this bug.

rockwyc992 added 2 commits May 8, 2017 19:31
fixed crystal-lang#4364

`(Something.some_method).is_a?(Const)` will transform to
`Const === Something.some_method`

It should clone the `node.const` and `node.obj` to do this work.
@rockwyc992
Copy link
Contributor Author

What?
Is there anyone who could restart this build?

Travis CI error log

==> Installing llvm 
==> Downloading https://homebrew.bintray.com/bottles/llvm-4.0.0_1.sierra.bottle.
Error: Failed to download resource "llvm"

@refi64
Copy link
Contributor

refi64 commented May 8, 2017

Just close and re-open the PR. It'll automatically restart the build.

@rockwyc992
Copy link
Contributor Author

@kirbyfan64 Thanks!
But someone has restarted this build, and it build passed.

@mverzilli
Copy link

Thanks! Looks good to me, I'm just running a couple of quick benchmarks and unless I find something odd there I'll merge it soon.

@mverzilli mverzilli merged commit 78e2d21 into crystal-lang:master May 8, 2017
@mverzilli mverzilli added this to the Next milestone May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants