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

Make abstract def return type warning an error #9655

Closed
Blacksmoke16 opened this issue Aug 3, 2020 · 0 comments · Fixed by #9810
Closed

Make abstract def return type warning an error #9655

Blacksmoke16 opened this issue Aug 3, 2020 · 0 comments · Fixed by #9810

Comments

@Blacksmoke16
Copy link
Member

Blacksmoke16 commented Aug 3, 2020

abstract class A
  abstract def foo : Int
end

class B < A
  def foo : String
    "..."
  end
end
In test.cr:6:13

 6 | def foo : String # Compiles alright
               ^
Warning: this method must return Int, which is the return type of the overridden method A#foo(), or a subtype of it, not String

The above warning will become an error in a future Crystal version.

A total of 1 warnings were found.

https://gitter.im/crystal-lang/crystal?at=5f28242861a83168463531de

oh, the return type check of abstract method. Yeah, it would make sense to have that in 1.0 as errors I think

and we could also remove the skip_abstract_def_check flag. it's been a while

\cc @bcardiff

@bcardiff bcardiff added this to the 1.0.0 milestone Aug 3, 2020
bcardiff added a commit to bcardiff/crystal that referenced this issue Oct 8, 2020
bcardiff pushed a commit that referenced this issue Oct 9, 2020
* Make abstract def return type warning an error

Fixes #9655

* Drop AbstractDefImplementationError

* Drop skip_abstract_def_check flag
@bcardiff bcardiff removed this from the 1.0.0 milestone Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants