File tree Expand file tree Collapse file tree 4 files changed +10
-5
lines changed
main/scala/com/avsystem/commons/misc
test/scala/com/avsystem/commons/misc Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 11package com .avsystem .commons .misc
22
3+ import com .avsystem .commons .IIterable
4+
35object NOpt {
46 // These two are used as NOpt's raw value to represent empty NOpt and NOpt(null).
57 // Unfortunately, null itself can't be used for that purpose because https://github.com/scala/bug/issues/7396
@@ -20,7 +22,7 @@ object NOpt {
2022 def some [A ](value : A ): NOpt [A ] =
2123 new NOpt (if (value == null ) NullMarker else value)
2224
23- implicit def opt2Iterable [A ](xo : NOpt [A ]): Iterable [A ] = xo.toList
25+ implicit def opt2Iterable [A ](xo : NOpt [A ]): IIterable [A ] = xo.toList
2426
2527 final val Empty : NOpt [Nothing ] = new NOpt (EmptyMarker )
2628
Original file line number Diff line number Diff line change 11package com .avsystem .commons .misc
22
3+ import com .avsystem .commons .IIterable
4+
35object Opt {
46 // Used as Opt's raw value to represent empty Opt. Unfortunately, null can't be used for that purpose
57 // because https://github.com/scala/bug/issues/7396
@@ -12,7 +14,7 @@ object Opt {
1214 if (value != null ) new Opt [A ](value)
1315 else throw new NullPointerException
1416
15- implicit def opt2Iterable [A ](xo : Opt [A ]): Iterable [A ] = xo.toList
17+ implicit def opt2Iterable [A ](xo : Opt [A ]): IIterable [A ] = xo.toList
1618
1719 final val Empty : Opt [Nothing ] = new Opt (EmptyMarker )
1820
Original file line number Diff line number Diff line change 11package com .avsystem .commons .misc
22
3+ import com .avsystem .commons .IIterable
4+
35object OptRef {
46 def apply [A >: Null ](value : A ): OptRef [A ] = new OptRef [A ](value)
57 def unapply [A >: Null ](opt : OptRef [A ]): OptRef [A ] = opt // name-based extractor
@@ -13,7 +15,7 @@ object OptRef {
1315 if (optRef.isEmpty) Opt .Empty else Opt (unboxing.fun(optRef.get))
1416 }
1517
16- implicit def opt2Iterable [A >: Null ](xo : OptRef [A ]): Iterable [A ] = xo.toList
18+ implicit def opt2Iterable [A >: Null ](xo : OptRef [A ]): IIterable [A ] = xo.toList
1719
1820 final val Empty : OptRef [Null ] = new OptRef [Null ](null )
1921
Original file line number Diff line number Diff line change 11package com .avsystem .commons .misc
22
3- import com .avsystem .commons
4- import org .scalatest .funsuite .AnyFunSuite
53import com .avsystem .commons .JInteger
4+ import org .scalatest .funsuite .AnyFunSuite
65
76class OptTest extends AnyFunSuite {
87 test(" nonempty test" ) {
You can’t perform that action at this time.
0 commit comments