Skip to content

Unit is not Unit #37

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
Dec 12, 2016
Merged

Unit is not Unit #37

merged 1 commit into from
Dec 12, 2016

Conversation

xuwei-k
Copy link
Member

@xuwei-k xuwei-k commented Dec 12, 2016

scala.Unit is companion object of ()

Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.

scala> val a = ()
a: Unit = ()

scala> val b = Unit
b: Unit.type = object scala.Unit

scala> a == b
<console>:14: warning: comparing values of types Unit and Unit.type using `==' will always yield false
       a == b
         ^
res1: Boolean = false

scala.Unit is companion object of `()`

```
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.

scala> val a = ()
a: Unit = ()

scala> val b = Unit
b: Unit.type = object scala.Unit

scala> a == b
<console>:14: warning: comparing values of types Unit and Unit.type using `==' will always yield false
       a == b
         ^
res1: Boolean = false
```
@takezoe takezoe merged commit 5eec152 into gitbucket:master Dec 12, 2016
@takezoe
Copy link
Member

takezoe commented Dec 12, 2016

@xuwei-k Thanks. It's a common mistake.

@xuwei-k xuwei-k deleted the Unit-is-not-Unit branch December 12, 2016 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants