@@ -238,7 +238,7 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
238238 * gets the `hashCode` method:
239239 *
240240 * ```
241- * "C".hashCode // constant folded
241+ * def hashCode: Int = "C".hashCode // constant folded
242242 * ```
243243 *
244244 * The class
@@ -247,7 +247,7 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
247247 * case class C(x: T, y: U)
248248 * ```
249249 *
250- * if non of `T` or `U` are primitive types, gets the `hashCode` method:
250+ * if none of `T` or `U` are primitive types, gets the `hashCode` method:
251251 *
252252 * ```
253253 * def hashCode: Int = ScalaRunTime._hashCode(this)
@@ -256,12 +256,12 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
256256 * else if either `T` or `U` are primitive, gets the `hashCode` method implemented by [[caseHashCodeBody ]]
257257 */
258258 def chooseHashcode (implicit ctx : Context ) = {
259- if clazz.is(ModuleClass ) then
259+ if ( clazz.is(ModuleClass ))
260260 Literal (Constant (clazz.name.stripModuleClassSuffix.toString.hashCode))
261- else if accessors `exists` (_.info.finalResultType.classSymbol.isPrimitiveValueClass) then
261+ else if ( accessors `exists` (_.info.finalResultType.classSymbol.isPrimitiveValueClass))
262262 caseHashCodeBody
263263 else
264- ref(defn.ScalaRuntimeModule ).select(" _hashCode " .toTermName ).appliedTo(This (clazz))
264+ ref(defn.ScalaRuntimeModule ).select(defn. ScalaRuntime__hashCode ).appliedTo(This (clazz))
265265 }
266266
267267 /** The class
@@ -275,19 +275,19 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
275275 * ```
276276 * def hashCode: Int = {
277277 * <synthetic> var acc: Int = 0xcafebabe
278- * acc = Statics.mix(acc, this.productPrefix.hashCode);
278+ * acc = Statics.mix(acc, this.productPrefix.hashCode() );
279279 * acc = Statics.mix(acc, x);
280280 * acc = Statics.mix(acc, Statics.this.anyHash(y));
281281 * Statics.finalizeHash(acc, 2)
282282 * }
283283 * ```
284284 */
285285 def caseHashCodeBody (implicit ctx : Context ): Tree = {
286- val acc = ctx.newSymbol(ctx.owner, " acc " .toTermName , Mutable | Synthetic , defn.IntType , coord = ctx.owner.span)
287- val accDef = ValDef (acc, Literal (Constant (0xcafebabe )))
286+ val acc = ctx.newSymbol(ctx.owner, nme.acc , Mutable | Synthetic , defn.IntType , coord = ctx.owner.span)
287+ val accDef = ValDef (acc, Literal (Constant (0xcafebabe )))
288288 val mixPrefix = Assign (ref(acc),
289- ref(defn.staticsMethod(" mix" )).appliedTo(ref(acc), This (clazz).select(defn.Product_productPrefix ).select(defn.Any_hashCode )))
290- val mixes = for accessor <- accessors yield
289+ ref(defn.staticsMethod(" mix" )).appliedTo(ref(acc), This (clazz).select(defn.Product_productPrefix ).select(defn.Any_hashCode ).appliedToNone ))
290+ val mixes = for ( accessor <- accessors) yield
291291 Assign (ref(acc), ref(defn.staticsMethod(" mix" )).appliedTo(ref(acc), hashImpl(accessor)))
292292 val finish = ref(defn.staticsMethod(" finalizeHash" )).appliedTo(ref(acc), Literal (Constant (accessors.size)))
293293 Block (accDef :: mixPrefix :: mixes, finish)
0 commit comments