diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-17 11:05:53 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-26 22:54:05 -0700 |
commit | 5f71e2e43b526c197ce4b8efaa85df101bef4fc4 (patch) | |
tree | 0153b60f08b9195e70c02186011cf04ca2ab9924 /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 8a7919bb543ee152dab9874abc37f9bbaac7eeaf (diff) | |
download | scala-5f71e2e43b526c197ce4b8efaa85df101bef4fc4.tar.gz scala-5f71e2e43b526c197ce4b8efaa85df101bef4fc4.tar.bz2 scala-5f71e2e43b526c197ce4b8efaa85df101bef4fc4.zip |
For backwards compat, sammy comes last
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 14 |
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) |