on master help sign in
No fallback if the decision tree tests are complete

Because we know these decision trees do not have any fall through, the last test is always skipped. If its last, it must succeed, so we do not need to know that the tests at this particular spot are complete.

commit831e1ad88618ddfd366251594c3e0396fe035200 authorEvan Czaplicki <info@elm-lang.org> dateFri 9 Oct 2015, 18:01 (11 years ago) parente303fba
1 file changed+8−10
src/Optimize/DecisionTree.hs+8−10
src/Optimize/DecisionTree.hs+8−10
@@ -252,18 +252,16 @@ gatherEdges variantDict branches path =
252252 relevantTests =
253253 testsAtPath path branches
254254
255− allRawEdges =
255+ allEdges =
256256 map (edgesFor path branches) relevantTests
257+
258+ fallbacks =
259+ if isComplete variantDict relevantTests then
260+ []
261+ else
262+ filter (isIrrelevantTo path) branches
257263 in
258− if isComplete variantDict relevantTests then
259− ( init allRawEdges
260− , snd (last allRawEdges)
261− )
262−
263− else
264− ( allRawEdges
265− , filter (isIrrelevantTo path) branches
266− )
264+ ( allEdges, fallbacks )
267265
268266
269267-- FIND RELEVANT TESTS