Skip to content

Better constant typing#529

Merged
soutaro merged 3 commits intomasterfrom
add-const-typing
Apr 5, 2022
Merged

Better constant typing#529
soutaro merged 3 commits intomasterfrom
add-const-typing

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