{"action":"created","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/2472","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/2472/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/2472/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/2472/events","html_url":"https://github.com/crystal-lang/crystal/issues/2472","id":148985207,"number":2472,"title":"Undefined local variable or method, when re-using variable from outer module","user":{"login":"waterlink","id":609046,"avatar_url":"https://avatars.githubusercontent.com/u/609046?v=3","gravatar_id":"","url":"https://api.github.com/users/waterlink","html_url":"https://github.com/waterlink","followers_url":"https://api.github.com/users/waterlink/followers","following_url":"https://api.github.com/users/waterlink/following{/other_user}","gists_url":"https://api.github.com/users/waterlink/gists{/gist_id}","starred_url":"https://api.github.com/users/waterlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waterlink/subscriptions","organizations_url":"https://api.github.com/users/waterlink/orgs","repos_url":"https://api.github.com/users/waterlink/repos","events_url":"https://api.github.com/users/waterlink/events{/privacy}","received_events_url":"https://api.github.com/users/waterlink/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-04-17T19:23:42Z","updated_at":"2016-04-17T20:38:00Z","closed_at":"2016-04-17T19:41:47Z","body":"Reduced example:\r\n\r\n```crystal\r\nmodule A\r\n  @@value : Int32\r\n  @@value = 41\r\n  \r\n  a_value = @@value\r\n  module B\r\n    @@value : Int32\r\n    @@value = a_value + 1\r\n  end\r\nend\r\n```\r\n\r\nIn my case `a_value` is actually a temporary variable, that is generated from macro. And I can generate next `@@value` only knowing such a value of outer context.\r\n\r\nCrystal version is HEAD, from commit crystal-lang/crystal@49271c355e9eaf750e0b994f5be79d52eea61079"},"comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments/211109433","html_url":"https://github.com/crystal-lang/crystal/issues/2472#issuecomment-211109433","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/2472","id":211109433,"user":{"login":"asterite","id":209371,"avatar_url":"https://avatars.githubusercontent.com/u/209371?v=3","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"created_at":"2016-04-17T20:38:00Z","updated_at":"2016-04-17T20:38:00Z","body":"Hmmm... the time for `@@started_at` shouldn't change, at least not that much. Do you have a small code to reproduce the problem? I tried this:\r\n\r\n```crystal\r\nclass Foo\r\n  @@started_at : Time\r\n  @@started_at = Time.now\r\n\r\n  def self.started_at\r\n    @@started_at\r\n  end\r\nend\r\n\r\npp Time.now\r\npp Foo.started_at\r\n```\r\n\r\nAnd I get the same value in both cases."}}