Skip to content

Commit

Permalink
refactor definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Aug 9, 2019
1 parent e9ce033 commit 1ade2b8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class Definitions {
@tu lazy val ScalaRuntimeModule: Symbol = ctx.requiredModule("scala.runtime.ScalaRunTime")
def runtimeMethodRef(name: PreName): TermRef = ScalaRuntimeModule.requiredMethodRef(name)
def ScalaRuntime_drop: Symbol = runtimeMethodRef(nme.drop).symbol
@tu lazy val ScalaRuntime__hashCode: Symbol = runtimeMethodRef("_hashCode").symbol
@tu lazy val ScalaRuntime__hashCode: Symbol = ScalaRuntimeModule.requiredMethod(nme._hashCode_)

@tu lazy val BoxesRunTimeModule: Symbol = ctx.requiredModule("scala.runtime.BoxesRunTime")
@tu lazy val ScalaStaticsModule: Symbol = ctx.requiredModule("scala.runtime.Statics")
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/StdNames.scala
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ object StdNames {
val getOrElse: N = "getOrElse"
val hasNext: N = "hasNext"
val hashCode_ : N = "hashCode"
val _hashCode_ : N = "_hashCode"
val hash_ : N = "hash"
val head: N = "head"
val higherKinds: N = "higherKinds"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ class SyntheticMembers(thisPhase: DenotTransformer) {
def chooseHashcode(implicit ctx: Context) = {
if (clazz.is(ModuleClass))
Literal(Constant(clazz.name.stripModuleClassSuffix.toString.hashCode))
else if (accessors `exists` (_.info.finalResultType.classSymbol.isPrimitiveValueClass))
else if (accessors.exists(_.info.finalResultType.classSymbol.isPrimitiveValueClass))
caseHashCodeBody
else
ref(defn.ScalaRuntimeModule).select(defn.ScalaRuntime__hashCode).appliedTo(This(clazz))
ref(defn.ScalaRuntime__hashCode).appliedTo(This(clazz))
}

/** The class
Expand Down

0 comments on commit 1ade2b8

Please sign in to comment.