Fix bug of unexpectedly resolving for an absolute class#156
Merged
soutaro merged 1 commit intoruby:masterfrom Jan 2, 2020
Merged
Fix bug of unexpectedly resolving for an absolute class#156soutaro merged 1 commit intoruby:masterfrom
soutaro merged 1 commit intoruby:masterfrom
Conversation
pocke
commented
Dec 31, 2019
| SignatureManager.new do |manager| | ||
| manager.files[Pathname("foo.rbs")] = <<EOF | ||
| class Array[Elem] | ||
| end |
Member
Author
There was a problem hiding this comment.
Array is not defined by SignatureManager in test_helper.
So the test failed by this patch. Because ::Array on the next line cannot be resolved.
I considered adding Array definition to the SignatureManager, but other tests define Array class, and they will conflict with SignatureManager's one if I define Array.
So I decided to add it here.
Member
|
Great fix! @pocke 👏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Ruby signature resolves unknown type unexpectedly if the type is absolute. That means it has
::prefix.I expect both type names, which are
c1andc2, are resolved asnil. Because the empty environment has no classes.But actually
c2is resolved as itself.Problem in the real application
I found the bug while I'm trying to use Steep.
I got different messages between
Cand::Cin superclass.First, I got the following output with sig1.rbs. I think it is the expected output.
However, I got an error with sig2.rbs.
Steep will print the same output with both signatures by this patch.