diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-27 13:19:39 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-27 13:19:39 -0700 |
commit | 091f3ba3a8a427d69f7cc7d2fafeebb38126ec93 (patch) | |
tree | 995a4fa0ace0853ddcde645b645a73eb2d5bfb43 /src/compiler | |
parent | 4b89ce639912d2143cc06ddb3b7da77c8fa8521d (diff) | |
parent | d290d0d1afe122fdeb3798364be7cda72cc182ec (diff) | |
download | scala-091f3ba3a8a427d69f7cc7d2fafeebb38126ec93.tar.gz scala-091f3ba3a8a427d69f7cc7d2fafeebb38126ec93.tar.bz2 scala-091f3ba3a8a427d69f7cc7d2fafeebb38126ec93.zip |
Merge pull request #2992 from retronym/ticket/7877
Only look for unapplies in term trees
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Unapplies.scala | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 311c0e09e3..e0ea555fe8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3245,7 +3245,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper if (!tree.isErrorTyped) setError(tree) else tree // @H change to setError(treeCopy.Apply(tree, fun, args)) - case ExtractorType(unapply) if mode.inPatternMode => + // SI-7877 `isTerm` needed to exclude `class T[A] { def unapply(..) }; ... case T[X] =>` + case HasUnapply(unapply) if mode.inPatternMode && fun.isTerm => if (unapply == QuasiquoteClass_api_unapply) macroExpandUnapply(this, tree, fun, unapply, args, mode, pt) else doTypedUnapply(tree, fun0, fun, args, mode, pt) diff --git a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala index 0c7c42db17..ed96f66ab8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Unapplies.scala @@ -39,7 +39,7 @@ trait Unapplies extends ast.TreeDSL { */ def unapplyMember(tp: Type): Symbol = directUnapplyMember(tp) filter (sym => !hasMultipleNonImplicitParamLists(sym)) - object ExtractorType { + object HasUnapply { def unapply(tp: Type): Option[Symbol] = unapplyMember(tp).toOption } |