diff options
-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]] + } + } +} |