@@ -535,8 +535,6 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
535535 def setupTraverser (checker : CheckerAPI ) = new TreeTraverserWithPreciseImportContexts :
536536 import checker .*
537537
538- private val paramSigChange = util.EqHashSet [Tree ]()
539-
540538 /** Transform type of tree, and remember the transformed type as the type of the tree
541539 * @pre !(boxed && sym.exists)
542540 */
@@ -547,8 +545,6 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
547545 then transformInferredType(tree.tpe)
548546 else transformExplicitType(tree.tpe, sym, freshen = ! boxed, tptToCheck = tree)
549547 if boxed then transformed = box(transformed)
550- if sym.is(Param ) && (transformed ne tree.tpe) then
551- paramSigChange += tree
552548 tree.setNuType(
553549 if sym.hasAnnotation(defn.UncheckedCapturesAnnot ) then makeUnchecked(transformed)
554550 else transformed)
@@ -653,19 +649,19 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
653649 else tree.tpt.nuType
654650
655651 // A test whether parameter signature might change. This returns true if one of
656- // the parameters has a new type installee . The idea here is that we store a new
652+ // the parameters has a new type installed . The idea here is that we store a new
657653 // type only if the transformed type is different from the original.
658654 def paramSignatureChanges = tree.match
659655 case tree : DefDef =>
660656 tree.paramss.nestedExists:
661- case param : ValDef => paramSigChange.contains( param.tpt)
662- case param : TypeDef => paramSigChange.contains( param.rhs)
657+ case param : ValDef => param.tpt.hasNuType
658+ case param : TypeDef => param.rhs.hasNuType
663659 case _ => false
664660
665661 // A symbol's signature changes if some of its parameter types or its result type
666662 // have a new type installed here (meaning hasRememberedType is true)
667663 def signatureChanges =
668- tree.tpt.hasNuType && ! sym.isConstructor || paramSignatureChanges
664+ tree.tpt.hasNuType || paramSignatureChanges
669665
670666 // Replace an existing symbol info with inferred types where capture sets of
671667 // TypeParamRefs and TermParamRefs are put in correspondence by BiTypeMaps with the
@@ -707,12 +703,11 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
707703
708704 // If there's a change in the signature, update the info of `sym`
709705 if sym.exists && signatureChanges then
710- val newInfo =
711- root.toResultInResults(report.error(_, tree.srcPos)):
712- integrateRT(sym.info, sym.paramSymss, localReturnType, Nil , Nil )
713- .showing(i " update info $sym: ${sym.info} = $result" , capt)
714- if newInfo ne sym.info then
715- val updatedInfo =
706+ val updatedInfo =
707+ val newInfo =
708+ root.toResultInResults(report.error(_, tree.srcPos)):
709+ integrateRT(sym.info, sym.paramSymss, localReturnType, Nil , Nil )
710+ .showing(i " update info $sym: ${sym.info} = $result" , capt)
716711 if sym.isAnonymousFunction
717712 || sym.is(Param )
718713 || sym.is(ParamAccessor )
@@ -728,8 +723,9 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
728723 assert(ctx.phase == thisPhase.next, i " $sym" )
729724 capt.println(i " forcing $sym, printing = ${ctx.mode.is(Mode .Printing )}" )
730725 // if ctx.mode.is(Mode.Printing) then new Error().printStackTrace()
731- completeDef(tree, sym, newInfo)
732- updateInfo(sym, updatedInfo)
726+ sym.info = newInfo
727+ completeDef(tree, sym, this )
728+ updateInfo(sym, updatedInfo)
733729
734730 case tree : Bind =>
735731 val sym = tree.symbol
0 commit comments