Skip to content

Commit

Permalink
Merge pull request #8681 from diesalbla/reuse_symbol_subst_map
Browse files Browse the repository at this point in the history
Types - copyRefinedType: reuse substitution maps.
  • Loading branch information
lrytz committed Feb 14, 2020
2 parents ca2573b + 6b0e663 commit fcfbf58
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/reflect/scala/reflect/internal/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4034,14 +4034,17 @@ trait Types
val result =
if (isIntersectionTypeForLazyBaseType(original)) intersectionTypeForLazyBaseType(parents)
else refinedType(parents, owner)
val syms1 = decls.toList
for (sym <- syms1)
result.decls.enter(sym.cloneSymbol(result.typeSymbol).resetFlag(OVERRIDE))
val syms2 = result.decls.toList
val resultThis = result.typeSymbol.thisType
for (sym <- syms2)
sym modifyInfo (_ substThisAndSym(original.typeSymbol, resultThis, syms1, syms2))

if (! decls.isEmpty){
val syms1 = decls.toList
for (sym <- syms1)
result.decls.enter(sym.cloneSymbol(result.typeSymbol).resetFlag(OVERRIDE))
val syms2 = result.decls.toList
val resultThis = result.typeSymbol.thisType
val substThisMap = new SubstThisMap(original.typeSymbol, resultThis)
val substMap = new SubstSymMap(syms1, syms2)
for (sym <- syms2)
sym.modifyInfo(info => substMap.apply(substThisMap.apply(info)))
}
result
}

Expand Down

0 comments on commit fcfbf58

Please sign in to comment.