-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Error creating Proc with explicit receiver #7577
Comments
This is fixed in master. I fixed it in #7334 |
@asterite Are you sure it's the same issue? The one you mentioned was about parsing, whereas this one parses well, and the error refers to LLVM. |
Pretty sure. In the PR I mention that I also found bugs with creating procs for methods of primitive types and that I fixed that. |
This does not produce the same error on the current master, as far as I can tell. Getting Crystal to compile on Ubuntu was interesting. But, uh: ~/s/c/crystal ❯❯❯ bin/crystal eval "a = 15; b = ->a.divisible_by?(Int32); pp [3,5,7].map(&b)"
Using compiled compiler at `.build/crystal'
[true, false, false]
~/s/c/crystal ❯❯❯ bin/crystal eval "a = 15; b = ->a.divisible_by?(Int32); pp [3,5,7].map(&b)"
Using compiled compiler at `.build/crystal'
[false, true, false]
~/s/c/crystal ❯❯❯ bin/crystal eval "a = 15; b = ->a.divisible_by?(Int32); pp [3,5,7].map(&b)"
Using compiled compiler at `.build/crystal'
[false, false, false] That probably shouldn't do that? ~/s/c/crystal ❯❯❯ bin/crystal --version
Using compiled compiler at `.build/crystal'
Crystal 0.28.0-dev [5282fdf91] (2019-03-23)
LLVM: 4.0.1
Default target: x86_64-pc-linux-gnu |
Yeah, I can confirm this non-deterministic behaviour on master. |
with this: a = 15
b = ->a.divisible_by?(Int32)
b.call(3)
b.call(3)
b.call(3) The results will be wrong most of the time, but each call produces the same results: either all |
Not sure it is the same bug: class A
@p : Proc(Int32, Bool)
def initialize(i)
@p = ->i.<(Int32)
end
end
A.new 1
|
Works in master, fixed in #9824 |
$crystal --version Crystal 0.27.2 [60760a546] (2019-02-05) LLVM: 4.0.0 Default target: x86_64-unknown-linux-gnu
Playground link
I've generally been having issues with trying to use Procs with a receiver. In Ruby I use the
method
method often. Crystal's syntax seems like it would be an improvement.The text was updated successfully, but these errors were encountered: