diff options
author | Paul Phillips <paulp@improving.org> | 2013-12-23 11:12:41 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-12-23 11:13:29 -0800 |
commit | 1696145f7642b309b326942f7a25bde3587d7449 (patch) | |
tree | 4ec5c08c77bc98a758ee2343e2b213cc1fab4959 /test/files/pos/t8045.scala | |
parent | def46a9d448c4ee84eea48694a65af438370f940 (diff) | |
download | scala-1696145f7642b309b326942f7a25bde3587d7449.tar.gz scala-1696145f7642b309b326942f7a25bde3587d7449.tar.bz2 scala-1696145f7642b309b326942f7a25bde3587d7449.zip |
SI-8045 type inference of extracted value
Test case for SI-8045, fixed by the preceding commits.
Diffstat (limited to 'test/files/pos/t8045.scala')
-rw-r--r-- | test/files/pos/t8045.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/pos/t8045.scala b/test/files/pos/t8045.scala new file mode 100644 index 0000000000..21154e386a --- /dev/null +++ b/test/files/pos/t8045.scala @@ -0,0 +1,17 @@ +object Test extends App { + case class Number(i: Int) + + object UnliftNumber { + def unapply(t: Any): Option[Number] = t match { + case i: Int => Some(Number(i)) + case _ => None + } + } + + def eval(expr: Any): Option[Number] = expr match { + case UnliftNumber(n) => Some(n) + case _ => None + } + + println(eval(1)) +} |