summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala14
1 files changed, 7 insertions, 7 deletions
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)