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

Union Types And Spawn #3088

Closed
CodeSteak opened this issue Aug 3, 2016 · 1 comment
Closed

Union Types And Spawn #3088

CodeSteak opened this issue Aug 3, 2016 · 1 comment

Comments

@CodeSteak
Copy link
Contributor

I'm not sure if this is a bug or would be a nice feature. It could also be duplicate with #2962.

class SomeClass 

    @a : Int32? = 1

    def something
        if a = @a 
            spawn do 
                # a is Int32 | Nil
                # a could be Int32
                a + 1 
            end
        end
    end
end
SomeClass.new.something
filename.cr:9: undefined method '+' for Nil (compile-time type is (Int32 | Nil))

                puts a + 1
                       ^

================================================================================

PS: Thank you for making this awesome language! ❤️

@asterite
Copy link
Member

asterite commented Aug 4, 2016

Yes, it's the same reason. I created a separate issue for this: #3093

@asterite asterite closed this as completed Aug 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants