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

Fix self types in module #523

Merged
merged 4 commits into from
Dec 17, 2020
Merged

Fix self types in module #523

merged 4 commits into from
Dec 17, 2020

Conversation

soutaro
Copy link
Member

@soutaro soutaro commented Dec 17, 2020

  1. Fix super_method calculation
  2. Let self_types be classes
  3. Assume Object is included in the self_types of modules if not specified

The 3 results in that we need to explicitly specify self_types if we want to include a module in Object

module M
end

class Object
  include M     # M implicitly assumes Object is the `self_type`, which causes a loop in ancestor chain.
end

The workaround is to specify BasicObject or an interface.

interface _WithSend
  def send: (Symbol) -> untyped
end

module M : _WithSend
end

@soutaro soutaro merged commit bc9cc00 into master Dec 17, 2020
@soutaro soutaro deleted the self-types branch December 17, 2020 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant