-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more tests about the erasure of Unit itself.
Outside of arrays or union types.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test-sources/src/main/scala/simple_trees/UnitErasure.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package simple_trees | ||
|
||
class UnitErasure: | ||
val unitVal: Unit = () | ||
|
||
var unitVar: Unit = () | ||
|
||
def unitParamelessDef: Unit = () | ||
|
||
def unitResult(): Unit = () | ||
|
||
def unitParam(x: Unit): Any = x | ||
|
||
def calls(): Unit = | ||
val _ = unitVal | ||
val _ = unitVar | ||
unitVar = () | ||
unitParamelessDef | ||
unitResult() | ||
unitParam(()) | ||
end calls | ||
end UnitErasure |