Skip to content

Commit 686292a

Browse files
committed
Avoid computing set of value classes getClass methods
1 parent b7e51db commit 686292a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/transform/InterceptedMethods.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ class InterceptedMethods extends MiniPhase {
4444

4545
override def phaseName: String = InterceptedMethods.name
4646

47-
private[this] var primitiveGetClassMethods: Set[Symbol] = _
47+
private[this] var scalaValueClasses: scala.collection.Set[Symbol] = _
4848

4949
/** perform context-dependant initialization */
5050
override def prepareForUnit(tree: Tree)(implicit ctx: Context) = {
51-
primitiveGetClassMethods = Set[Symbol]() ++ defn.ScalaValueClasses().map(x => x.requiredMethod(nme.getClass_))
51+
scalaValueClasses = defn.ScalaValueClasses()
5252
ctx
5353
}
5454

@@ -105,7 +105,7 @@ class InterceptedMethods extends MiniPhase {
105105
List(qual, typer.resolveClassTag(tree.pos, qual.tpe.widen))))
106106
}*/
107107
*/
108-
case t if primitiveGetClassMethods.contains(t) =>
108+
case t if t.name == nme.getClass_ && scalaValueClasses.contains(t.owner) =>
109109
// if we got here then we're trying to send a primitive getClass method to either
110110
// a) an Any, in which cage Object_getClass works because Any erases to object. Or
111111
//

0 commit comments

Comments
 (0)