Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

strictEquality == works even if the given CanEqual fails #13725

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

Closed
soronpo opened this issue Oct 10, 2021 · 1 comment
Closed

strictEquality == works even if the given CanEqual fails #13725

soronpo opened this issue Oct 10, 2021 · 1 comment
Assignees
Labels

Comments

@soronpo
Copy link
Contributor

soronpo commented Oct 10, 2021

If an implicit to the CanEqual is introduced and fails, the == operation still compiles successfully.

Compiler version

v3.1.0-RC3

Minimized code

import scala.language.strictEquality
class Foo()
inline given CanEqual[Int, Foo] = compiletime.error("This should fail")

val x = 1 == Foo()

Output

No error

Expectation

We should get the error "This should fail"

@soronpo soronpo changed the title == equality works even if the given CanEqual fails strictEquality == works even if the given CanEqual fails Oct 10, 2021
@soronpo soronpo added the area:implicits related to implicits label Oct 10, 2021
@bishabosha
Copy link
Member

bishabosha commented Oct 11, 2021

I would not call this as a bug, the spec only requires that a definition exists in context for CanEqual[L, R], it is never actually evaluated by ==

@scala scala locked and limited conversation to collaborators Oct 11, 2021
@odersky odersky closed this as completed Oct 11, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants