Skip to content

Commit 58477a2

Browse files
committed
Add comments
1 parent 6558b34 commit 58477a2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

library/src/scala/quoted/Expr.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ package internal {
191191
*/
192192
final class TastyTreeExpr[Tree](val tree: Tree, val scopeId: Int) extends Expr[Any] {
193193
override def equals(that: Any): Boolean = that match {
194-
case that: TastyTreeExpr[_] => tree == that.tree && scopeId == that.scopeId
194+
case that: TastyTreeExpr[_] =>
195+
// TastyTreeExpr are wrappers around trees, therfore they are equals if their trees are equal.
196+
// All scopeId should be equal unless two different runs of the compiler created the trees.
197+
tree == that.tree && scopeId == that.scopeId
195198
case _ => false
196199
}
197200
override def hashCode: Int = tree.hashCode

library/src/scala/quoted/Type.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ package internal {
7272
/** An Type backed by a tree */
7373
final class TreeType[Tree](val typeTree: Tree, val scopeId: Int) extends scala.quoted.Type[Any] {
7474
override def equals(that: Any): Boolean = that match {
75-
case that: TreeType[_] => typeTree == that.typeTree && scopeId == that.scopeId
75+
case that: TreeType[_] => typeTree ==
76+
// TastyTreeExpr are wrappers around trees, therfore they are equals if their trees are equal.
77+
// All scopeId should be equal unless two different runs of the compiler created the trees.
78+
that.typeTree && scopeId == that.scopeId
7679
case _ => false
7780
}
7881
override def hashCode: Int = typeTree.hashCode

0 commit comments

Comments
 (0)