forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for private[this] parameter in value classes
- Loading branch information
1 parent
ea407f1
commit f49f00c
Showing
4 changed files
with
21 additions
and
6 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
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
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
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,18 @@ | ||
package privatethisparam | ||
|
||
class Meter[T](x: T) extends AnyVal { | ||
def zero: T = x | ||
} | ||
|
||
class Meter2(private[this] val x: Int) extends AnyVal { | ||
def foo = x | ||
} | ||
|
||
object Test { | ||
def bar = new Meter2(42) | ||
def useZero = new Meter(5).zero | ||
def test: Unit = { | ||
val m1 = new Meter(1) | ||
m1.zero | ||
} | ||
} |