From 0497c1513b9c8e561e16ebb56a004b5baabf8ecd Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 22 May 2012 11:03:42 +0200 Subject: TreeMaker approximation refactorings and bug fixes - TypeTestTreeMaker subsumes the old TypeTestTM and TypeAndEqualityTM its type- and equality-testing logic is configurable so that it can: - generate trees (main purpose) - check whether this tree maker is a pure type test - generate the proposition that models this tree maker (for exhaustivity and other analyses) - [CSE] subst binders of dropped tm's to stored ones somehow the refactoring broke the replacement of the binder of dropped treemakers by the binder of the reused treemaker when replacing TM1(x1 => ...) >> TM2(x2 => ...) >> TM3(x3 => ...) >> ... TM1'(x1' => ...) >> TM2'(x2' => ...) >> TM3(x3' => ...) >> ... by Memo1(x1 => ...) >> TM2(x2 => ...) >> Memo2(x3 => ...) >> ... Reuse(Memo2)... you need to replace x1' and x2' by x1 since TM2 tested a shared condition but was not memo-ised, that implies it simply passed x1 through to x3 unmodified, and x2' can simply use the stored x1 - type of first uniqued binder sets type of tree when approximating a tree of treemakers as a DAG, where sharing indicates the same value is tested, use the type of the binder that was first used to create a unique tree as the type of that tree, and thus all trees used for the same binder in the future - track substitution of alternatives when approximating - error on unswitchable @switch annotated matches if we can't turn a match (with more than two cases) into a switch, but the user insists, emit an error misc notes: - when all you need is nextBinder, FunTreeMaker is your guy - must pass flag to TypeTestTM for extractorarg test case TypeTestTreeMaker(prevBinder, testedBinder, expectedTp, nextBinderTp) (prevBinder eq testedBinder) does not imply it's a pure type test for an extractor call note that the expected type for an extractor argument is not a type pattern, thus we only do a classic type test -- the idea was to detect that case by noticing we're being called with the same previous and tested binder, but that case also arises for Typed patterns --- test/files/pos/no-widen-locals.scala | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 test/files/pos/no-widen-locals.scala (limited to 'test/files') diff --git a/test/files/pos/no-widen-locals.scala b/test/files/pos/no-widen-locals.scala deleted file mode 100644 index 013e63f0a2..0000000000 --- a/test/files/pos/no-widen-locals.scala +++ /dev/null @@ -1,19 +0,0 @@ -// Worked from r23262 until that was reverted somewhere -// around r25016. -import annotation.switch - -object Test { - def f(x: Int) = { - val X1 = 5 - val X2 = 10 - val X3 = 15 - val X4 = 20 - - (x: @switch) match { - case X1 => 1 - case X2 => 2 - case X3 => 3 - case X4 => 4 - } - } -} -- cgit v1.2.3