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

Better constant typing #529

Merged
merged 3 commits into from
Apr 5, 2022
Merged

Better constant typing #529

merged 3 commits into from
Apr 5, 2022

Conversation

soutaro
Copy link
Owner

@soutaro soutaro commented Apr 5, 2022

Found and fixed two bugs.

  1. The :const node didn't have type if it's unknown
  2. Reporting all of the constant components look too noisey (see below)

Before:

lib/rbs_protobuf/translator/base.rb:17:22: [information] Cannot find the declaration of constant: `Google`
│ Diagnostic ID: Ruby::UnknownConstant
│
└         @response ||= Google::Protobuf::Compiler::CodeGeneratorResponse.new
                        ~~~~~~

lib/rbs_protobuf/translator/base.rb:17:30: [information] Cannot find the declaration of constant: `Protobuf`
│ Diagnostic ID: Ruby::UnknownConstant
│
└         @response ||= Google::Protobuf::Compiler::CodeGeneratorResponse.new
                                ~~~~~~~~

lib/rbs_protobuf/translator/base.rb:17:40: [information] Cannot find the declaration of constant: `Compiler`
│ Diagnostic ID: Ruby::UnknownConstant
│
└         @response ||= Google::Protobuf::Compiler::CodeGeneratorResponse.new
                                          ~~~~~~~~

lib/rbs_protobuf/translator/base.rb:17:50: [information] Cannot find the declaration of constant: `CodeGeneratorResponse`
│ Diagnostic ID: Ruby::UnknownConstant
│
└         @response ||= Google::Protobuf::Compiler::CodeGeneratorResponse.new
                                                    ~~~~~~~~~~~~~~~~~~~~~

After:

lib/rbs_protobuf/translator/base.rb:17:22: [information] Cannot find the declaration of constant: `Google`
│ Diagnostic ID: Ruby::UnknownConstant
│
└         @response ||= Google::Protobuf::Compiler::CodeGeneratorResponse.new
                        ~~~~~~

This would look better. 💪

@soutaro soutaro enabled auto-merge April 5, 2022 04:57
@soutaro soutaro merged commit 1e54967 into master Apr 5, 2022
@soutaro soutaro deleted the add-const-typing branch April 5, 2022 05:11
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.

1 participant