diff options
author | michelou <michelou@epfl.ch> | 2007-11-02 15:20:38 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-11-02 15:20:38 +0000 |
commit | 42b43e8b3884edf42bf07a24c711854a8a6bcee9 (patch) | |
tree | a54b84125ae5b61fda80101f348fb3e30a805917 /src/library/scala/Option.scala | |
parent | b9d874ba4ea8952f852810abd57d6742d53030ce (diff) | |
download | scala-42b43e8b3884edf42bf07a24c711854a8a6bcee9.tar.gz scala-42b43e8b3884edf42bf07a24c711854a8a6bcee9.tar.bz2 scala-42b43e8b3884edf42bf07a24c711854a8a6bcee9.zip |
added basic support for runtime types
Diffstat (limited to 'src/library/scala/Option.scala')
-rw-r--r-- | src/library/scala/Option.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala index 4a72a44511..0f66b16230 100644 --- a/src/library/scala/Option.scala +++ b/src/library/scala/Option.scala @@ -9,7 +9,7 @@ // $Id$ -package scala; +package scala import Predef._ @@ -17,9 +17,11 @@ import Predef._ object Option { /** An implicit conversion that converts an option to an iterable value */ - implicit def option2Iterable[a](xo: Option[a]): Iterable[a] = xo.toList -} + implicit def option2Iterable[A](xo: Option[A]): Iterable[A] = xo.toList + implicit def someRep[A](implicit elemrep: runtime.TypeRep[A]): runtime.TypeRep[Some[A]] = + runtime.TypeRep.SomeRep(elemrep) +} /** This class represents optional values. Instances of <code>Option</code> * are either instances of case class <code>Some</code> or it is case |