From 1ed25d9dd0c9914b1a90baf178efd19bc0f0775d Mon Sep 17 00:00:00 2001 From: David MacIver Date: Wed, 3 Sep 2008 20:38:01 +0000 Subject: More bugs from tickets added to pending. --- test/pending/pos/t1035.scala | 32 ++++++++++++++++++++++++++++++++ test/pending/pos/t796.scala | 20 ++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 test/pending/pos/t1035.scala create mode 100644 test/pending/pos/t796.scala (limited to 'test/pending') diff --git a/test/pending/pos/t1035.scala b/test/pending/pos/t1035.scala new file mode 100644 index 0000000000..2e2f911bc4 --- /dev/null +++ b/test/pending/pos/t1035.scala @@ -0,0 +1,32 @@ +//A fatal error or Scala compiler +// Scala compiler version 2.7.1-final -- (c) 2002-2007 LAMP/EPFL +// Carlos Loria cloria@artinsoft.com +// 7/10/2008 + +class A { + var name:String = _ + def getName() = name + def this(name:String, age:Int){this();this.name=name} + +} + +class B(name:String) extends A(name,0){ +} + +class D { + + object A { + def unapply(p:A) = Some(p.getName) + } + + object B { + def unapply(p:B) = Some(p.getName) + } + def foo(p:Any) = p match { + case B(n) => println("B") + case A(n) => println("A") + + + } + +} \ No newline at end of file diff --git a/test/pending/pos/t796.scala b/test/pending/pos/t796.scala new file mode 100644 index 0000000000..c013f49686 --- /dev/null +++ b/test/pending/pos/t796.scala @@ -0,0 +1,20 @@ +case class CaseClass( value: Int ); + +object PatternMatchBug { + def matcher( a: AnyRef, b: Any ) { + (a, b) match { + case ( instance: CaseClass, instance.value ) => + System.out.println( "Match succeeded!" ); + case _ => + System.out.println( "Match failed!" ); + } + } + + def main( args : Array[String] ) { + val caseClassInstance = CaseClass( 42 ) + + matcher( caseClassInstance, 13 ) + matcher( caseClassInstance, 42 ) + } +} + -- cgit v1.2.3