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

docs: An interface can include interfaces only and not modules #1996

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

tk0miya
Copy link
Contributor

@tk0miya tk0miya commented Sep 7, 2024

I found an interface can include interfaces only and not modules. Is my understanding correct?
If true, it's better to fix the syntax document.

Example:

# sig/example.rbs
module Foo
end

interface _Bar
  include Foo
end
bundle exec rbs -I sig validate                                                                                                                        ~/work/tmp/steep [main]
bundler: failed to load command: rbs (/Users/tkomiya/.dotfiles/_rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bin/rbs)
/Users/tkomiya/.dotfiles/_rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rbs-3.5.3/lib/rbs/parser_aux.rb:20:in `_parse_signature': sig/example.rbs:5:10...5:13: Syntax error: expected one of interface name, token=`Foo` (tUIDENT) (RBS::ParsingError)

    include Foo
            ^^^

	from /Users/tkomiya/.dotfiles/_rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rbs-3.5.3/lib/rbs/parser_aux.rb:20:in `parse_signature'
	from /Users/tkomiya/.dotfiles/_rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rbs-3.5.3/lib/rbs/environment_loader.rb:161:in `block (2 levels) in each_signature'
(snip)

An interface can include interfaces only and not modules.  Therefore
it's better to fix the syntax document.
@soutaro soutaro added this pull request to the merge queue Sep 13, 2024
@soutaro soutaro added this to the RBS 3.6 milestone Sep 13, 2024
Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

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

Thanks!

Merged via the queue into ruby:master with commit a34a071 Sep 13, 2024
19 checks passed
@tk0miya tk0miya deleted the docs/fix_interface_includes branch September 13, 2024 14:08
@soutaro soutaro added the Released PRs already included in the released version label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

2 participants