diff options
author | Martin Odersky <odersky@gmail.com> | 2015-10-30 17:07:51 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-10-30 17:07:51 +0100 |
commit | f6e454ba8ba2f1183177e1f69788bf9610512c3f (patch) | |
tree | cfebabddaac9998da05900a08d0b912b154d5082 | |
parent | 465ea96afb46e29fb523dad884f0ba860eeea6ff (diff) | |
download | dotty-f6e454ba8ba2f1183177e1f69788bf9610512c3f.tar.gz dotty-f6e454ba8ba2f1183177e1f69788bf9610512c3f.tar.bz2 dotty-f6e454ba8ba2f1183177e1f69788bf9610512c3f.zip |
Fix #877
Use freshName to name evidence parameters.
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 2 | ||||
-rw-r--r-- | tests/pos/i877.scala | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index d1f101283..621ac8ece 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -132,7 +132,7 @@ object desugar { case tparam @ TypeDef(_, ContextBounds(tbounds, cxbounds)) => for (cxbound <- cxbounds) { val paramFlags: FlagSet = if (isPrimaryConstructor) PrivateLocalParamAccessor else Param - val epname = (nme.EVIDENCE_PARAM_PREFIX.toString + epbuf.length).toTermName + val epname = ctx.freshName(nme.EVIDENCE_PARAM_PREFIX).toTermName epbuf += ValDef(epname, cxbound, EmptyTree).withFlags(paramFlags | Implicit) } cpy.TypeDef(tparam)(rhs = tbounds) diff --git a/tests/pos/i877.scala b/tests/pos/i877.scala new file mode 100644 index 000000000..45a71ae0d --- /dev/null +++ b/tests/pos/i877.scala @@ -0,0 +1,11 @@ +class First[A] +class Second[A] + +class Foo { + def foo[A: First] = { + def bar[B: Second] = { + val fst: First[A] = implicitly[First[A]] + val snd: Second[B] = implicitly[Second[B]] + } + } +} |