Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Relax assertEquals strictness about type equality. #70

Merged
merged 6 commits into from
Mar 20, 2020

Conversation

olafurpg
Copy link
Member

Following up from an offline conversation with @gabro

Previously, assertEquals only allowed comparing values of the same
type. Now, it's OK as long as the second argument is a subtype of the
first argument. The reasoning for this change is that it's common that
you want to test some generic value like Option[Int] obtained from a
method we're testing against an expected hardcoded value like
Some[Int].

Previously, `assertEquals` only allowed comparing values of the same
type. Now, it's OK as long as the second argument is a subtype of the
first argument. The reasoning for this change is that it's common that
you want to test some generic value like `Option[Int]` obtained from a
method we're testing against an expected hardcoded value like
`Some[Int]`.
@olafurpg olafurpg requested a review from gabro March 20, 2020 08:27
if one value is a subtype of the other.
The "expected" value (second argument) must be a subtype of the "obtained" value
(first argument). It's a type error to compare two values even if one value is a
subtype of the other.
Copy link
Member

Choose a reason for hiding this comment

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

is it still a type error?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not a type error, removed

Copy link
Member

@gabro gabro left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Olafur Pall Geirsson added 2 commits March 20, 2020 10:12
Users navigating to the source via IDEs can then learn about the
`assertEquals[Any, Any]` escape hatch.
@olafurpg olafurpg force-pushed the subtype branch 5 times, most recently from eb5f1ab to 77f3264 Compare March 20, 2020 10:28
@olafurpg
Copy link
Member Author

Yay figured out the cryptic windows failures!

@olafurpg olafurpg merged commit 37a0459 into scalameta:master Mar 20, 2020
@olafurpg olafurpg deleted the subtype branch March 20, 2020 11:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants