summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala16
-rw-r--r--test/files/pos/t6891.flags (renamed from test/pending/pos/t6891.flags)0
-rw-r--r--test/files/pos/t6891.scala (renamed from test/pending/pos/t6891.scala)7
3 files changed, 23 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 62998ef6cb..a528a9ced8 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -1440,6 +1440,22 @@ trait Trees extends api.Trees { self: SymbolTable =>
if (tree.hasSymbol) {
subst(from, to)
tree match {
+ case _: DefTree =>
+ val newInfo = symSubst(tree.symbol.info)
+ if (!(newInfo =:= tree.symbol.info)) {
+ debuglog(sm"""
+ |TreeSymSubstituter: updated info of symbol ${tree.symbol}
+ | Old: ${showRaw(tree.symbol.info, printTypes = true, printIds = true)}
+ | New: ${showRaw(newInfo, printTypes = true, printIds = true)}""")
+ tree.symbol updateInfo newInfo
+ }
+ case _ =>
+ // no special handling is required for Function or Import nodes here.
+ // as they don't have interesting infos attached to their symbols.
+ // Subsitution of the referenced symbol of Return nodes is handled
+ // in .ChangeOwnerTraverser
+ }
+ tree match {
case Ident(name0) if tree.symbol != NoSymbol =>
treeCopy.Ident(tree, tree.symbol.name)
case Select(qual, name0) if tree.symbol != NoSymbol =>
diff --git a/test/pending/pos/t6891.flags b/test/files/pos/t6891.flags
index fe048006aa..fe048006aa 100644
--- a/test/pending/pos/t6891.flags
+++ b/test/files/pos/t6891.flags
diff --git a/test/pending/pos/t6891.scala b/test/files/pos/t6891.scala
index bf79c2d293..bed2d0d777 100644
--- a/test/pending/pos/t6891.scala
+++ b/test/files/pos/t6891.scala
@@ -9,6 +9,13 @@ object O {
@annotation.tailrec def loop(x: value.type): Unit = loop(x)
()
}
+
+ def beppy[C](c: => C) = {
+ () => c
+ @annotation.tailrec def loop(x: value.type): Unit = loop(x)
+ () => c
+ ()
+ }
}
// uncaught exception during compilation: Types$TypeError("type mismatch;
// found : A(in method bippy$extension)