Skip to content

Commit f6e454b

Browse files
committed
Fix #877
Use freshName to name evidence parameters.
1 parent 465ea96 commit f6e454b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ object desugar {
132132
case tparam @ TypeDef(_, ContextBounds(tbounds, cxbounds)) =>
133133
for (cxbound <- cxbounds) {
134134
val paramFlags: FlagSet = if (isPrimaryConstructor) PrivateLocalParamAccessor else Param
135-
val epname = (nme.EVIDENCE_PARAM_PREFIX.toString + epbuf.length).toTermName
135+
val epname = ctx.freshName(nme.EVIDENCE_PARAM_PREFIX).toTermName
136136
epbuf += ValDef(epname, cxbound, EmptyTree).withFlags(paramFlags | Implicit)
137137
}
138138
cpy.TypeDef(tparam)(rhs = tbounds)

tests/pos/i877.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class First[A]
2+
class Second[A]
3+
4+
class Foo {
5+
def foo[A: First] = {
6+
def bar[B: Second] = {
7+
val fst: First[A] = implicitly[First[A]]
8+
val snd: Second[B] = implicitly[Second[B]]
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)