diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2017-03-20 23:45:48 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2017-03-21 00:33:39 +0100 |
commit | 6135363f8730421202eeb39494d3720b9124131c (patch) | |
tree | fe8d99d999be7ab7e844091e34fca216c2343dcb /compiler/src/dotty/tools/dotc/ast/Desugar.scala | |
parent | f45dbe7e3722f0c6a814c8afd8481690ac5f1d2c (diff) | |
download | dotty-6135363f8730421202eeb39494d3720b9124131c.tar.gz dotty-6135363f8730421202eeb39494d3720b9124131c.tar.bz2 dotty-6135363f8730421202eeb39494d3720b9124131c.zip |
Fix desugaring of variable pattern leaking into API
This was especially bad for incremental compilation since the temporary
variable name is unstable.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/ast/Desugar.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/ast/Desugar.scala | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index b5be89440..75c7078a1 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -557,7 +557,7 @@ object desugar { * val/var/lazy val p = e ==> val/var/lazy val x_1 = (e: @unchecked) match (case p => (x_1)) * * in case there are zero or more than one variables in pattern - * val/var/lazy p = e ==> private synthetic [lazy] val t$ = (e: @unchecked) match (case p => (x_1, ..., x_N)) + * val/var/lazy p = e ==> private[this] synthetic [lazy] val t$ = (e: @unchecked) match (case p => (x_1, ..., x_N)) * val/var/def x_1 = t$._1 * ... * val/var/def x_N = t$._N @@ -586,7 +586,8 @@ object desugar { derivedValDef(original, named, tpt, matchExpr, mods) case _ => val tmpName = ctx.freshName().toTermName - val patMods = mods & (AccessFlags | Lazy) | Synthetic + val patMods = + mods & Lazy | Synthetic | (if (ctx.owner.isClass) PrivateLocal else EmptyFlags) val firstDef = ValDef(tmpName, TypeTree(), matchExpr) .withPos(pat.pos.union(rhs.pos)).withMods(patMods) |