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

Add deprecation message to PartialComparable #7664

Merged
merged 3 commits into from Apr 12, 2019

Conversation

Projects
None yet
2 participants
@straight-shoota
Copy link
Member

commented Apr 11, 2019

Follow up on #6611

Adding @[Deprecated] annotation to #<=> method is not detected by the warning feature. I don't think it makes sense to add annotations to the other methods. This module seems to be pretty much not used anywhere at all.

@bcardiff

This comment has been minimized.

Copy link
Member

commented Apr 12, 2019

The issue with detecting the deprecation of <=> is that it's an abstract method. And annotations of abstrac methods are not passed to their implementation.

module Foo
  @[Deprecated]
  abstract def foo
end

class Bar
  include Foo

  def foo
    1
  end
end

puts Bar.new.foo

That is the same story as identifing if a method is overriding or declaring a new method.

I this case the best thing to do is deprecate the constant/module itself.

It would be great to detect mentions of deprecated constants after 0.28.

@bcardiff
Copy link
Member

left a comment

The @[Deprecated] can be used before the docs comment and will be output in the html docs.
There might be something with the parser regarding the order of docs and annotations.

WDYT about using the annotation?

@[Deprecated("This module is deprecated as of Crystal 0.28.0. Its behaviour has been fully integrated into `Comparable`.")]
@bcardiff

This comment has been minimized.

Copy link
Member

commented Apr 12, 2019

@straight-shoota, when I checked locally the deprecation, is only emitted if it goes before the docs comment.

The @[Deprecated] can be used before the docs comment and will be output in the html docs.
There might be something with the parser regarding the order of docs and annotations.

@straight-shoota

This comment has been minimized.

Copy link
Member Author

commented Apr 12, 2019

Sry, missed that.

It's super weird though :)

@bcardiff bcardiff merged commit c56be30 into master Apr 12, 2019

5 checks passed

ci/circleci: check_format Your tests passed on CircleCI!
Details
ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
ci/circleci: test_linux32 Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@straight-shoota straight-shoota deleted the feature/deprecate-partial-compare branch Apr 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.