From 7b7d17757177579319d2efa1fd94cea218ad8780 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 11 Feb 2011 09:34:50 +0000 Subject: Fix for #4188. It seems to arise from the changes to inner objects which make them look like lazy vals. I am not sure this is the right change but at least it's only about a six character diff to review. Closes #4188, review by odersky. --- src/compiler/scala/tools/nsc/matching/ParallelMatching.scala | 2 +- src/compiler/scala/tools/nsc/symtab/TypeDebugging.scala | 2 +- test/files/pos/bug4188.scala | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/files/pos/bug4188.scala diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala index 007c74dc3c..89e849d038 100644 --- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala +++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala @@ -878,7 +878,7 @@ trait ParallelMatching extends ast.TreeDSL case ConstantType(Constant(null)) if isRef => scrutTree OBJ_EQ NULL case ConstantType(Constant(value)) => scrutTree MEMBER_== Literal(value) case SingleType(NoPrefix, sym) => genEquals(sym) - case SingleType(pre, sym) if sym.isModule => genEquals(sym) + case SingleType(pre, sym) if sym.isStable => genEquals(sym) case ThisType(sym) if sym.isModule => genEquals(sym) case _ if isMatchUnlessNull => scrutTree OBJ_NE NULL case _ => scrutTree IS tpe diff --git a/src/compiler/scala/tools/nsc/symtab/TypeDebugging.scala b/src/compiler/scala/tools/nsc/symtab/TypeDebugging.scala index 12e10879bd..5ed7344bd8 100644 --- a/src/compiler/scala/tools/nsc/symtab/TypeDebugging.scala +++ b/src/compiler/scala/tools/nsc/symtab/TypeDebugging.scala @@ -21,7 +21,7 @@ trait TypeDebugging { } def dump(tp: Type): Unit = { - println("** " + tp + " **") + println("** " + tp + " / " + tp.getClass + " **") import tp._ println("typeSymbol = " + typeSymbol) diff --git a/test/files/pos/bug4188.scala b/test/files/pos/bug4188.scala new file mode 100644 index 0000000000..40e7d4924e --- /dev/null +++ b/test/files/pos/bug4188.scala @@ -0,0 +1,6 @@ +class A { + object Ding + class B { + (null: Any) match { case _: Ding.type => () } + } +} -- cgit v1.2.3