From 5f71e2e43b526c197ce4b8efaa85df101bef4fc4 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 17 Mar 2016 11:05:53 -0700 Subject: For backwards compat, sammy comes last --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 5c108c5fda..6bf2ec46c8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1055,13 +1055,6 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper if (hasUndets) return instantiate(tree, mode, pt) - // we know `!(tree.tpe <:< pt)`; try to remedy if there's a sam for pt - val sam = samMatchingFunction(tree, pt) // this implies tree.isInstanceOf[Function] - if (sam.exists) { - val samTree = adaptToSAM(sam, tree.asInstanceOf[Function], pt, mode) - if (samTree ne EmptyTree) return samTree - } - if (context.implicitsEnabled && !pt.isError && !tree.isErrorTyped) { // (14); the condition prevents chains of views debuglog("inferring view from " + tree.tpe + " to " + pt) @@ -1082,6 +1075,13 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper } } } + + // we know `!(tree.tpe <:< pt)`; try to remedy if there's a sam for pt + val sam = samMatchingFunction(tree, pt) // this implies tree.isInstanceOf[Function] + if (sam.exists) { + val samTree = adaptToSAM(sam, tree.asInstanceOf[Function], pt, mode) + if (samTree ne EmptyTree) return samTree + } } debuglog("error tree = " + tree) -- cgit v1.2.3