-
-
Save taylorfinnell/4f71199f746fe8abca9b214827ebf144 to your computer and use it in GitHub Desktop.
hello
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
def on_thing(&block : Int32 ->) | |
@on_thing_cb = block | |
end | |
end | |
class A | |
def hi | |
end | |
end | |
x = [A.new, nil] | |
test = Test.new | |
if y = x[0] | |
test.on_thing do |i| | |
y.hi # undefined method 'hi' for Nil (compile-time type is (A | Nil)) | |
end | |
end | |
# If I change the last part to do this, no error | |
test = Test.new | |
if y = x[0] | |
g = y | |
test.on_thing do |i| | |
g.hi | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment