Skip to content

Commit c17c95c

Browse files
committed
SI-5788 correct test and symbol update
Previously I thought it's fixed because I didn't include the correct testcase. Now it's the correct testcase and this prompted me to change the code a bit to make it work properly.
1 parent af19824 commit c17c95c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/compiler/scala/tools/nsc/typechecker/Duplicators.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,15 @@ abstract class Duplicators extends Analyzer {
283283

284284
// the typer does not create the symbols for a LabelDef's params, so unless they were created before we need
285285
// to do it manually here -- but for the tailcalls-generated labels, ValDefs are created before the LabelDef,
286-
// so we just need to plug in the name
286+
// so we just need to change the tree to point to the updated symbols
287287
def newParam(p: Tree): Ident =
288288
if (isTailLabel)
289-
Ident(p.symbol.name) // let the typer pick up the right symbol
289+
Ident(updateSym(p.symbol))
290290
else {
291291
val newsym = p.symbol.cloneSymbol //(context.owner) // TODO owner?
292292
Ident(newsym.setInfo(fixType(p.symbol.info)))
293293
}
294+
294295
val params1 = params map newParam
295296
val rhs1 = (new TreeSubstituter(params map (_.symbol), params1) transform rhs) // TODO: duplicate?
296297
rhs1.tpe = null

test/files/pos/SI-5788.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
trait Test {
2-
trait B[T]
3-
private final def grow[T](): B[T] = grow[T]()
1+
trait Foo[@specialized(Int) A] {
2+
final def bar(a:A):A = bar(a)
43
}

0 commit comments

Comments
 (0)