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

Fix constant assignment as alias with Hash #509

Merged

Conversation

aycabta
Copy link
Member

@aycabta aycabta commented Sep 2, 2017

In constant assignment with class/module name, it behaves as alias.

class Klass
end

class Klass2
  CONSTANT = Klass
end

Klass2::CONSTANT is an alias of Klass.

But, some consntants are Hash, RDoc treats it as alias.

class Klass
end

class Klass3
  CONSTANT_2 = {}
  CONSTANT_2[1] = Klass
end

Klass3::CONSTANT_2 is an alias of Klass for RDoc, it's bug.

This Pull Request fixes it.

In constant assignment with class/module name,
it behaves as alias.

  class Klass
  end

  class Klass2
    CONSTANT = Klass
  end

Klass2::CONSTANT is an alias of Klass.

But, some consntants are Hash,
RDoc treats it as alias.

  class Klass
  end

  class Klass3
    CONSTANT_2 = {}
    CONSTANT_2[1] = Klass
  end

Klass3::CONSTANT_2 is an alias of Klass for RDoc,
it's bug.

This commit fixes it.
@aycabta aycabta merged commit 6bd9bf3 into ruby:master Sep 5, 2017
@aycabta aycabta deleted the fix-constant-assignment-as-alias-with-hash branch September 5, 2017 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant