aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-10-20 12:16:06 +0200
committerGitHub <noreply@github.com>2016-10-20 12:16:06 +0200
commitcd235600dac18ccb75ea1f1c8158ad9bd5307cdf (patch)
tree5aef344fae92a43edcf291cbeab5f81a633246ef /tests
parent0d1721c8aebaf6877e9d1ea3d65d40446a869170 (diff)
parente82cb7cdb93306b5fccf6aeef0e087999f46a016 (diff)
downloaddotty-cd235600dac18ccb75ea1f1c8158ad9bd5307cdf.tar.gz
dotty-cd235600dac18ccb75ea1f1c8158ad9bd5307cdf.tar.bz2
dotty-cd235600dac18ccb75ea1f1c8158ad9bd5307cdf.zip
Merge pull request #1595 from dotty-staging/fix-#1567
Fix #1567: Widen private constructor in value class
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/1567/PosZInt_1.scala6
-rw-r--r--tests/pos/1567/Test_2.scala3
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/pos/1567/PosZInt_1.scala b/tests/pos/1567/PosZInt_1.scala
new file mode 100644
index 000000000..60b4061e6
--- /dev/null
+++ b/tests/pos/1567/PosZInt_1.scala
@@ -0,0 +1,6 @@
+final class PosZInt private (val value: Int) extends AnyVal
+
+object PosZInt {
+ def from(value: Int): Option[PosZInt] =
+ if (value >= 0) Some(new PosZInt(value)) else None
+}
diff --git a/tests/pos/1567/Test_2.scala b/tests/pos/1567/Test_2.scala
new file mode 100644
index 000000000..db6ca7070
--- /dev/null
+++ b/tests/pos/1567/Test_2.scala
@@ -0,0 +1,3 @@
+object Test {
+ scala.util.Try(PosZInt.from(1).get)
+}