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

Exclude abstract defs from "no overload matches" errors #10483

Merged

Conversation

HertzDevil
Copy link
Contributor

Abstract defs are never callable and therefore do not affect whether any overload matches a given call. (Even if they do, every abstract def must be subsumed by another non-abstract def.) Given:

module Foo
  abstract def foo(x : Int32)
end

class Bar
  include Foo

  def foo(x : Int32); end
end

Bar.new.foo('a')

# Error: no overload matches 'Bar#foo' with type Char
#
# Overloads are:
#  - Bar#foo(x : Int32)
#  - Foo#foo(x : Int32)

This PR removes Foo#foo(x : Int32) from the error message.

Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

Thank you @HertzDevil 🙏

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic labels Mar 8, 2021
@bcardiff bcardiff added this to the 1.0.0 milestone Mar 9, 2021
@bcardiff bcardiff merged commit 3bc7a9a into crystal-lang:master Mar 9, 2021
@HertzDevil HertzDevil deleted the bug/error-abstract-overload branch March 10, 2021 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants