@@ -31,10 +31,12 @@ object Synthetics:
31
31
* The types of these symbols are transformed in a special way without
32
32
* looking at the definitions's RHS
33
33
*/
34
- def needsTransform (sym : SymDenotation )(using Context ): Boolean =
35
- isSyntheticCopyMethod(sym)
36
- || isSyntheticCompanionMethod(sym, nme.apply, nme.unapply)
37
- || isSyntheticCopyDefaultGetterMethod(sym)
34
+ def needsTransform (symd : SymDenotation )(using Context ): Boolean =
35
+ isSyntheticCopyMethod(symd)
36
+ || isSyntheticCompanionMethod(symd, nme.apply, nme.unapply)
37
+ || isSyntheticCopyDefaultGetterMethod(symd)
38
+ || (symd.symbol eq defn.Object_eq )
39
+ || (symd.symbol eq defn.Object_ne )
38
40
39
41
/** Method is excluded from regular capture checking.
40
42
* Excluded are synthetic class members
@@ -166,7 +168,9 @@ object Synthetics:
166
168
sym.copySymDenotation(info = addUnapplyCaptures(sym.info))
167
169
case nme.apply | nme.copy =>
168
170
sym.copySymDenotation(info = addCaptureDeps(sym.info))
169
-
171
+ case n if n == nme.eq || n == nme.ne =>
172
+ sym.copySymDenotation(info =
173
+ MethodType (defn.ObjectType .capturing(CaptureSet .universal) :: Nil , defn.BooleanType ))
170
174
171
175
/** If `sym` refers to a synthetic apply, unapply, copy, or copy default getter method
172
176
* of a case class, transform it back to what it was before the CC phase.
@@ -179,5 +183,7 @@ object Synthetics:
179
183
sym.copySymDenotation(info = dropUnapplyCaptures(sym.info))
180
184
case nme.apply | nme.copy =>
181
185
sym.copySymDenotation(info = dropCaptureDeps(sym.info))
186
+ case n if n == nme.eq || n == nme.ne =>
187
+ sym.copySymDenotation(info = defn.methOfAnyRef(defn.BooleanType ))
182
188
183
189
end Synthetics
0 commit comments