Skip to content

Commit

Permalink
Fix hashCode
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun committed Oct 6, 2024
1 parent 7dd6202 commit 97c2362
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/src/dotty/tools/dotc/transform/init/Objects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ class Objects(using Context @constructorOnly):

case _ => false

override def hashCode(): Int =
this.klass.hashCode
+ this.vals.hashCode
+ this.vars.hashCode
+ this.outers.hashCode
+ this.env.hashCode

def widen(height: Int): OfClass =
val vals2 = vals.map { (k, v) => k -> v.widen(height) }
val outers2 = outers.map { (k, v) => k -> v.widen(height) }
Expand Down

0 comments on commit 97c2362

Please sign in to comment.