diff options
author | Martin Odersky <odersky@gmail.com> | 2011-11-22 18:07:51 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-11-22 18:07:51 +0000 |
commit | ac031789039d421186567cf3b9a484957e6e5f8e (patch) | |
tree | 5145e02ea0debdf1cd2a467ad8568e2813a03c56 /test/disabled/pos/t1545.scala | |
parent | cd696035896fd82c622687107ec4b70cf3f3298e (diff) | |
download | scala-ac031789039d421186567cf3b9a484957e6e5f8e.tar.gz scala-ac031789039d421186567cf3b9a484957e6e5f8e.tar.bz2 scala-ac031789039d421186567cf3b9a484957e6e5f8e.zip |
Compiler part of fast orElse.
"According to the spec this code should not be legal. Disabling for
now." Need to come back and either make it work or (more likely) make
nsc reject the test)
Diffstat (limited to 'test/disabled/pos/t1545.scala')
-rwxr-xr-x | test/disabled/pos/t1545.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/disabled/pos/t1545.scala b/test/disabled/pos/t1545.scala new file mode 100755 index 0000000000..4c5908b8a1 --- /dev/null +++ b/test/disabled/pos/t1545.scala @@ -0,0 +1,18 @@ +// According to the spec this code should not be legal. +// Disabling for now. +object Main extends App { + + case class Foo (field : Option[String]) + + val x : PartialFunction[Foo,Int] = + { + c => c.field match { + case Some (s) => 42 + case None => 99 + } + } + + println (x (Foo (None))) // prints 99 + println (x (Foo (Some ("foo")))) // prints 42 + +} |