diff options
author | odersky <odersky@gmail.com> | 2016-12-10 14:46:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-10 14:46:04 +0100 |
commit | 4daf543cf6857295807a8a9d37890891274255a9 (patch) | |
tree | d2ad97d9af40edfdf17ec9c00910094c206610c9 /compiler/src/dotty/tools/dotc/ast/Desugar.scala | |
parent | 48309018fc2ab8d38c46408326f739e5652412c7 (diff) | |
parent | a7003bb223fb535f64a3026ff2a5a3e7d3ab7609 (diff) | |
download | dotty-4daf543cf6857295807a8a9d37890891274255a9.tar.gz dotty-4daf543cf6857295807a8a9d37890891274255a9.tar.bz2 dotty-4daf543cf6857295807a8a9d37890891274255a9.zip |
Merge pull request #1768 from dotty-staging/fix-#1765
Fix #1765: Context bounds and denotation handling
Diffstat (limited to 'compiler/src/dotty/tools/dotc/ast/Desugar.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/ast/Desugar.scala | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala index 7f25d6b0c..15cb0b665 100644 --- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala +++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala @@ -142,16 +142,21 @@ object desugar { val DefDef(name, tparams, vparamss, tpt, rhs) = meth val mods = meth.mods val epbuf = new ListBuffer[ValDef] - val tparams1 = tparams mapConserve { - case tparam @ TypeDef(_, ContextBounds(tbounds, cxbounds)) => + def desugarContextBounds(rhs: Tree): Tree = rhs match { + case ContextBounds(tbounds, cxbounds) => for (cxbound <- cxbounds) { val paramFlags: FlagSet = if (isPrimaryConstructor) PrivateLocalParamAccessor else Param val epname = ctx.freshName(nme.EVIDENCE_PARAM_PREFIX).toTermName epbuf += ValDef(epname, cxbound, EmptyTree).withFlags(paramFlags | Implicit) } - cpy.TypeDef(tparam)(rhs = tbounds) - case tparam => - tparam + tbounds + case PolyTypeTree(tparams, body) => + cpy.PolyTypeTree(rhs)(tparams, desugarContextBounds(body)) + case _ => + rhs + } + val tparams1 = tparams mapConserve { tdef => + cpy.TypeDef(tdef)(rhs = desugarContextBounds(tdef.rhs)) } val meth1 = addEvidenceParams(cpy.DefDef(meth)(tparams = tparams1), epbuf.toList) |