aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-02-13 20:14:55 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-02-18 23:35:34 +0100
commit8fe124f1517fba9cb833c82e52ba6f6ba01da735 (patch)
tree0767adb538c069f8ebcea4a42f0d5aaa4478827a /compiler/src/dotty/tools/dotc/typer/Applications.scala
parent2979a14d0e4b10dc897d027dbfc827fc7624a520 (diff)
downloaddotty-8fe124f1517fba9cb833c82e52ba6f6ba01da735.tar.gz
dotty-8fe124f1517fba9cb833c82e52ba6f6ba01da735.tar.bz2
dotty-8fe124f1517fba9cb833c82e52ba6f6ba01da735.zip
typedUnApply#trySelectUnapply: small cleanup
Previously, `specificProto` was a def even though it is always called, this is because in cece884812143c6c8090ce08c6321bd4a1d52ea6, the usages of `specificProto` and `genericProto` were swapped. We fix this by only defining the protos where they are used. Incidentally, this mean that the calls to UnapplyFunProto will use the correct Context inside `tryEither`, although in this case this shouldn't matter.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Applications.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala
index 6c5dac5d4..5e092871d 100644
--- a/compiler/src/dotty/tools/dotc/typer/Applications.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -805,16 +805,16 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
* whereas overloaded variants need to have a conforming variant.
*/
def trySelectUnapply(qual: untpd.Tree)(fallBack: Tree => Tree): Tree = {
- val genericProto = new UnapplyFunProto(WildcardType, this)
- def specificProto = new UnapplyFunProto(selType, this)
// try first for non-overloaded, then for overloaded ocurrences
def tryWithName(name: TermName)(fallBack: Tree => Tree)(implicit ctx: Context): Tree =
- tryEither {
- implicit ctx => typedExpr(untpd.Select(qual, name), specificProto)
+ tryEither { implicit ctx =>
+ val specificProto = new UnapplyFunProto(selType, this)
+ typedExpr(untpd.Select(qual, name), specificProto)
} {
(sel, _) =>
- tryEither {
- implicit ctx => typedExpr(untpd.Select(qual, name), genericProto)
+ tryEither { implicit ctx =>
+ val genericProto = new UnapplyFunProto(WildcardType, this)
+ typedExpr(untpd.Select(qual, name), genericProto)
} {
(_, _) => fallBack(sel)
}