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

Error message with rbs_collection #111

Closed
okuramasafumi opened this issue Mar 9, 2022 · 7 comments · Fixed by ruby/rbs#921
Closed

Error message with rbs_collection #111

okuramasafumi opened this issue Mar 9, 2022 · 7 comments · Fixed by ruby/rbs#921

Comments

@okuramasafumi
Copy link

I noticed that I see a. weird error message when I execute typeprof command with rbs_collection settings.

Here's a reproduction repository:
https://github.com/okuramasafumi/typeprof-bug-repro

@mame
Copy link
Member

mame commented Mar 10, 2022

Thank you for your report. Your repro works well for me. Could you elaborate how to reproduce the issue?

$ git clone https://github.com/okuramasafumi/typeprof-bug-repro
Cloning into 'typeprof-bug-repro'...
cd remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 10 (delta 1), reused 10 (delta 1), pack-reused 0
Receiving objects: 100% (10/10), done.
Resolving deltas: 100% (1/1), done.

$ cd typeprof-bug-repro/

$ bundle
Bundler 2.4.0.dev is running, but your lockfile was generated with 2.3.6. Installing Bundler 2.3.6 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.3.6
Installing bundler 2.3.6
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using bundler 2.3.6
Fetching rbs 2.2.2
Installing rbs 2.2.2 with native extensions
Using typeprof 0.21.2
Bundle complete! 2 Gemfile dependencies, 3 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

$ bundle exec rbs collection install
Using json:0 (/home/mame/work/ruby/local/lib/ruby/gems/3.2.0/gems/rbs-2.2.2/stdlib/json/0)
It's done! 1 gems' RBSs now installed.

$ bundle exec typeprof foo.rb
# TypeProf 0.21.2

# Classes
class Foo
  def bar: -> String
end

@okuramasafumi
Copy link
Author

I noticed that I saw Using rbs:2.2.2 (/Users/okuramasafumi/.gem/ruby/3.1.1/gems/rbs-2.2.2/sig) line when I execute bundle exec rbs collection install. That's the only different from your output.

@pocke
Copy link
Member

pocke commented Mar 10, 2022

I noticed that I saw Using rbs:2.2.2 (/Users/okuramasafumi/.gem/ruby/3.1.1/gems/rbs-2.2.2/sig) line when I execute bundle exec rbs collection install. That's the only different from your output.

The line means rbs collection uses rbs gem's .rbs files for typeprof.
It does not appear because the rbs_collection.yaml has an entry to ignore rbs gem's .rbs files.
https://github.com/okuramasafumi/typeprof-bug-repro/blob/4db5ab4f9021754ca48da87121b137cea8a26b28/rbs_collection.yaml#L11-L13

I guess your configuration file doesn't have the ignore entry, could you confirm it?

@okuramasafumi
Copy link
Author

I guess your configuration file doesn't have the ignore entry, could you confirm it?

I included all files in the repo, where's my configuration?

@pocke
Copy link
Member

pocke commented Mar 10, 2022

I guessed you used something else, such as not committed file, in another repo, etc.
RBS reads rbs_collection.yaml and rbs_collection.lock.yaml in the current directory, so we need to check them.

By the way, I guess I found the cause of the difference between us 🙈
After I executed rbs collection install, the lockfile has a difference.

$ git diff rbs_collection.lock.yaml
diff --git a/rbs_collection.lock.yaml b/rbs_collection.lock.yaml
index 3736270..6a321ef 100644
--- a/rbs_collection.lock.yaml
+++ b/rbs_collection.lock.yaml
@@ -10,7 +10,3 @@ gems:
   version: '0'
   source:
     type: stdlib
-- name: rbs
-  version: 2.2.2
-  source:
-    type: rubygems

And I can reproduce the problem by resetting the difference.

In order to fix the reproducing repo, we need to remove the entry to ignore rbs gem, like the following:

$ git diff rbs_collection.yaml
diff --git a/rbs_collection.yaml b/rbs_collection.yaml
index 93de20f..a7e42e7 100644
--- a/rbs_collection.yaml
+++ b/rbs_collection.yaml
@@ -9,6 +9,4 @@ sources:
 path: .gem_rbs_collection
 
 gems:
-  - name: rbs
-    ignore: true
   - name: json

Then we can reproduce the problem 🙌


I think this is ruby/rbs's problem. I'll try fixing it.
You can also suppress this problem by adding the entry to ignore rbs gem to rbs_collection.yaml and executing rbs collection install to sync the lockfile.

Thanks for reporting it!

@okuramasafumi
Copy link
Author

@pocke Thanks for helping me, I now understand how lockfile works.
I'll keep this issue open until the problem in RBS resolved, thank you!

@mame
Copy link
Member

mame commented Mar 24, 2022

I close this ticket as @pocke said this issue was fixed in the side of rbs gem. Thank you for your report!

@mame mame closed this as completed Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants