Skip to content

Commit b743ec0

Browse files
committed
Drop redundant code
1 parent 267bca3 commit b743ec0

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -520,26 +520,13 @@ trait TypeAssigner {
520520
tree.withType(proto)
521521

522522
def assignType(tree: untpd.ValDef, sym: Symbol)(implicit ctx: Context) =
523-
tree.withType(if (sym.exists) assertExists(symbolicIfNeeded(sym).orElse(sym.termRef)) else NoType)
523+
tree.withType(if (sym.exists) assertExists(sym.termRef) else NoType)
524524

525525
def assignType(tree: untpd.DefDef, sym: Symbol)(implicit ctx: Context) =
526-
tree.withType(symbolicIfNeeded(sym).orElse(sym.termRef))
526+
tree.withType(sym.termRef)
527527

528528
def assignType(tree: untpd.TypeDef, sym: Symbol)(implicit ctx: Context) =
529-
tree.withType(symbolicIfNeeded(sym).orElse(sym.typeRef))
530-
531-
private def symbolicIfNeeded(sym: Symbol)(implicit ctx: Context) = { // ??? can we drop this?
532-
val owner = sym.owner
533-
if (owner.isClass && owner.isCompleted && owner.asClass.givenSelfType.exists)
534-
// In that case a simple typeRef/termWithWithSig could return a member of
535-
// the self type, not the symbol itself. To avoid this, we make the reference
536-
// symbolic. In general it seems to be faster to keep the non-symbolic
537-
// reference, since there is less pressure on the uniqueness tables that way
538-
// and less work to update all the different references. That's why symbolic references
539-
// are only used if necessary.
540-
NamedType(owner.thisType, sym)
541-
else NoType
542-
}
529+
tree.withType(sym.typeRef)
543530

544531
def assertExists(tp: Type) = { assert(tp != NoType); tp }
545532

0 commit comments

Comments
 (0)