You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
new Meter(3).hashCode() should be replaced by Meter.hashCode$extension(3) in phase VCInline but it isn't because isMethodWithExtension returns false for hashCode because its owner is Any. This is incorrect because the phase SyntheticMethods will add an hashCode method to Meter. For value classes this problem can only happen with hashCode and equals (and a few other methods if the value class is also a case class), so I could work around it by hardcoding these methods into isMethodWithExtension, but maybe it's worth solving the underlying problem, I don't know what consequences it could have.
The text was updated successfully, but these errors were encountered:
Changes that should follow merging #515 should change how SyntheticMethods handles value classes.
SyntheticMethods already specially handles synthesis of every method for value class. After #515 gets merged, there would be less methods to synthesize and thus less special handling.
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
May 4, 2015
For example:
new Meter(3).hashCode()
should be replaced byMeter.hashCode$extension(3)
in phaseVCInline
but it isn't becauseisMethodWithExtension
returns false forhashCode
because its owner isAny
. This is incorrect because the phaseSyntheticMethods
will add anhashCode
method toMeter
. For value classes this problem can only happen withhashCode
andequals
(and a few other methods if the value class is also a case class), so I could work around it by hardcoding these methods intoisMethodWithExtension
, but maybe it's worth solving the underlying problem, I don't know what consequences it could have.The text was updated successfully, but these errors were encountered: