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

Incorrectly reporting shadowingOuterLocalVar within macro included #161

Closed
Blacksmoke16 opened this issue Jul 15, 2020 · 0 comments
Closed
Labels

Comments

@Blacksmoke16
Copy link
Contributor

Blacksmoke16 commented Jul 15, 2020

Reboot of #129.

annotation Foo; end

module Foo
  macro included
    def serialization_properties
      {% for ann in @def.annotations Name %}
        {% pos_args = ann.args.empty? ? "Tuple.new".id : ann.args %}
        {% named_args = ann.named_args.empty? ? "NamedTuple.new".id : ann.named_args %}
      {% end %}
    end

    def self.deserialization_properties
      {{@type.instance_vars.map do |ivar|
          ivar.annotations(Name).each do |ann|
            pos_args = ann.args.empty? ? "Tuple.new".id : ann.args
            named_args = ann.named_args.empty? ? "NamedTuple.new".id : ann.named_args
          end
        end}}
    end
  end
end
test.cr:14:45
[W] Lint/ShadowingOuterLocalVar: Shadowing outer local variable `ann`
> ivar.annotations(Name).each do |ann|
^
Finished in 6.21 milliseconds

1 inspected, 1 failure.

I imagine this is a result of new types that aren't being checked from crystal-lang/crystal#9120.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants