Skip to content

Commit 0e4e2bd

Browse files
committed
More extensive optimizations
1 parent 90226bd commit 0e4e2bd

File tree

2 files changed

+298
-30
lines changed

2 files changed

+298
-30
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,17 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
682682
case _ =>
683683
false
684684
}
685+
def hash(implicit ctx: Context): Int =
686+
t1.getClass.hashCode * 37 + {
687+
t1 match {
688+
case t1: Ident => t1.symbol.hashCode
689+
case t1 @ Select(q1, _) => t1.symbol.hashCode * 41 + q1.hash
690+
case Literal(c1) => c1.hashCode
691+
case Apply(f1, as1) => (f1.hash /: as1)((h, arg) => h * 41 + arg.hash)
692+
case TypeApply(f1, ts1) => (f1.hash /: ts1)((h, arg) => h * 41 + arg.tpe.hash)
693+
case _ => t1.hashCode
694+
}
695+
}
685696
}
686697
}
687698

0 commit comments

Comments
 (0)