diff options
author | michelou <michelou@epfl.ch> | 2007-02-28 18:45:49 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-02-28 18:45:49 +0000 |
commit | 2867ff421b7ce685f4a5fabc2dafbc12b760f3b1 (patch) | |
tree | 65208882a17001fae28565b24d265522fcc35465 /src | |
parent | a13f7c0a01c64990fdabd14bd93595e293722af6 (diff) | |
download | scala-2867ff421b7ce685f4a5fabc2dafbc12b760f3b1.tar.gz scala-2867ff421b7ce685f4a5fabc2dafbc12b760f3b1.tar.bz2 scala-2867ff421b7ce685f4a5fabc2dafbc12b760f3b1.zip |
added code example to scaladoc comment
Diffstat (limited to 'src')
-rwxr-xr-x | src/library/scala/unsealed.scala | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/library/scala/unsealed.scala b/src/library/scala/unsealed.scala index 4379ea7971..5bbe0fa3e7 100755 --- a/src/library/scala/unsealed.scala +++ b/src/library/scala/unsealed.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -11,8 +11,33 @@ package scala -/** - * An annotation that gets applied to a selector in a match expression. - * If it is present, exhaustiveness warnings for that expression will be suppressed. +/** <p> + * An annotation that gets applied to a selector in a match expression. + * If it is present, exhaustiveness warnings for that expression will be + * suppressed. + * </p> + * <p> + * For example, compiling the code: + * </p><pre> + * <b>object</b> test <b>extends</b> Application { + * <b>def</b> f(x: Option[int]) = x <b>match</b> { + * <b>case</b> Some(y) => y + * } + * f(None) + * }</pre> + * <p> + * will display the following warning: + * </p><pre> + * test.scala:2: warning: does not cover case {object None} + * def f(x: Option[int]) = x match { + * ^ + * one warning found</pre> + * <p> + * The above message may be suppressed by substituting the expression + * <code>x</code> with <code>(x: @unsealed)</code>. Then the + * modified code will compile silently, but, in any case, a + * <a href="MatchError.html"><code>MatchError</code></a> + * will be raised at runtime. + * </p> */ class unsealed extends Annotation {} |