Skip to content

Fix #4180: Can't compare Scala and Java Booleans #4181

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

Merged
merged 1 commit into from
Mar 26, 2018

Conversation

smarter
Copy link
Member

@smarter smarter commented Mar 25, 2018

No description provided.

@smarter smarter requested a review from odersky March 25, 2018 19:01
val a = s == j
val b = j == s
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just confirmed those comparisons give the expected result, though I guess this might not warrant a test:

$ /usr/local/bin/dotr
Starting dotty REPL...
scala> val v: java.lang.Boolean = true
val v: Boolean = true
scala> val w: Boolean = true
val w: Boolean = true
scala> v == w
1 |v == w
  |^^^^^^
  |Values of types Boolean and Boolean cannot be compared with == or !=
scala>  implicit def eqSBoolJBool: Eq[Boolean, java.lang.Boolean] = Eq
implicit val eqSBoolJBool: Eq[Boolean, Boolean]
scala> v == w
1 |v == w
  |^^^^^^
  |Values of types Boolean and Boolean cannot be compared with == or !=
scala> w == v
val res0: Boolean = true
scala> w == false
val res1: Boolean = false
scala> implicit def eqJBoolSBool: Eq[java.lang.Boolean, Boolean] = Eq
implicit val eqJBoolSBool: Eq[Boolean, Boolean]
scala> v == w
val res2: Boolean = true
scala> v == false
val res3: Boolean = false

@smarter smarter merged commit d72323e into scala:master Mar 26, 2018
@allanrenucci allanrenucci deleted the fix/boolean-eq branch March 26, 2018 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants