From d1def30417d44ef2a6830b3337bf4063c7144b4b Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 17 Feb 2016 10:37:44 +1000 Subject: SI-9658 Fix crosstalk between partial fun. and GADT match When typechecking the synthetic default case of a pattern matching anonymous partial function, we failed to create a new `Context`. This led to crosstalk with the management of the saved type bounds of an enclosing GADT pattern match. This commit avoids the direct call to `typeCase` and instead indirects through `typedCases`, which spawns a new nested typer context, and hence avoids the crosstalk when `restoreSavedTypeBounds` runs. --- test/files/pos/t9658.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/files/pos/t9658.scala (limited to 'test') diff --git a/test/files/pos/t9658.scala b/test/files/pos/t9658.scala new file mode 100644 index 0000000000..a2c695a8ae --- /dev/null +++ b/test/files/pos/t9658.scala @@ -0,0 +1,10 @@ +sealed trait G[T] +case object GI extends G[Int] + +class C { + def typerFail[T](rt: G[T]): T = rt match { + case GI => + { case x => x } : PartialFunction[Any, Any] // comment this line, compiles. + 0 // found Int, required T + } +} -- cgit v1.2.3