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

Add types in and around Grammar.rb #433

Merged
merged 6 commits into from
Jun 6, 2024

Conversation

Little-Rubyist
Copy link
Contributor

Grammar.rb has been added to Steep's monitoring targets. Along with this, we have defined many types.
Additionally, we have modified implementations where type consistency could not be maintained (the changes have been discussed with @yui-knk).
We have refactored parts where the return value could include nil so that Steep can correctly detect them.

Copy link
Collaborator

@junk0612 junk0612 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you for your contribution to the developer experience.

@@ -44,7 +44,9 @@ def add_term(id:, alias_name: nil, tag: nil, token_id: nil, replace: false)
end

def add_nterm(id:, alias_name: nil, tag: nil)
return if find_symbol_by_id(id)
if (sym = find_symbol_by_id(id))
return sym
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why you changed it to return sym, but I see it's because the previous version could return nil, which would fail type checking. Understood. It also aligns the behavior with add_term, which seems good.

@junk0612 junk0612 merged commit f60ee94 into ruby:master Jun 6, 2024
16 checks passed
@Little-Rubyist Little-Rubyist deleted the check_type_for_grammar branch June 11, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants