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
Passing block to class_property tries to return first assignment in block #5295
Comments
Your example shows improper usage of Proper version is as follows: require "logger"
module Test
class_property(logger) { Logger.new(STDOUT) }
end
Test.logger.info "logme" |
@jhass I'd suggest removing those tags since it's neither bug nor it's related to the compiler. |
Well, how does it get typed as def self.logger
@@logger ||= begin
@@logger ||= begin
a = 1
Logger.new(STDOUT)
end
end
end The last expression in the inner |
@jhass indeed, you're right! even though included usage of |
@Sija you are correct I was using @jhass Thanks for minimizing that code, i now know I was using it incorrectly ,but that particular change in behavior didn't seem right to me. |
Both examples now show
|
@vlazar Yes, thanks! It seems to be working fine now. I don't know what fixed it. |
The following happened recently on master.
Running this code.
returns
class variable '@@logger' of Test must be (Logger | Nil), not Int32
crystal version
This works correctly in 0.23.1 and worked on 0.24.0 a few days ago so a recent change may have caused this.
The text was updated successfully, but these errors were encountered: