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 bin/sort for constants #919

Merged
merged 1 commit into from Mar 11, 2022
Merged

Conversation

pocke
Copy link
Member

@pocke pocke commented Mar 8, 2022

This PR partially fixes issue #918.

Previously bin/sort raises an error on a constant declaration in a class decl.

For example:

# test.rbs
class C
  def foo: () -> void
  C: String
  B: String
  A: String
end
$ bin/sort test.rbs
bin/sort:71:in `sort!': comparison of RBS::AST::Members::MethodDefinition with RBS::AST::Declarations::Constant failed (ArgumentError)
	from bin/sort:71:in `block (2 levels) in <main>'
	from bin/sort:68:in `each'
	from bin/sort:68:in `block in <main>'
	from bin/sort:62:in `each'
	from bin/sort:62:in `<main>'
Opening test.rbs...

This change fixes this problem. The test.rbs will be sorted as the following.

# test.rbs
class C
  A: String
  B: String
  C: String
  def foo: () -> void
end

@pocke pocke merged commit 6cc9f0f into ruby:master Mar 11, 2022
@pocke pocke deleted the Fix__bin_sort__for_constants branch March 11, 2022 10:04
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.

None yet

1 participant