-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Optimize findRef #4156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize findRef #4156
Conversation
... by inlining two frequently used submethods
I noted this happening from tyoime to time in the IDE, and it is super annoying when it happens. Let's see if we can survive meaningfully after ignoring this condition.
test performance please |
performance test scheduled: 1 job(s) in queue, 1 running. |
@@ -549,7 +549,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean | |||
if (inst.exists) sigName(inst) else tpnme.Uninstantiated | |||
case tp: TypeProxy => | |||
sigName(tp.underlying) | |||
case _: ErrorType | WildcardType => | |||
case _: ErrorType | WildcardType | NoType => | |||
tpnme.WILDCARD | |||
case tp: WildcardType => | |||
sigName(tp.optBounds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this code match twice against WildcardType
? I don't get it. In fact, the latter matches appear to be erased away:
scala> def foo: Any => Any = { case _: String | Int => 1; case _: Int => 2 }
def foo: Any => Any
scala> foo(1)
val res0: Any = 2
scala> def foo: Any => Any = { case _: String | AnyRef => 1; case _: AnyRef => 2 }
def foo: Any => Any
scala> foo(new AnyRef())
val res1: Any = 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It first matches against the object WildcardType
, then the case below matches against any instance of the class WildcardType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sorry, Allan explained me what's going on. But do we really know that the only instance of WildcardType(NoType)
is the WildcardType
object?
case _ => | ||
go(tp.superType) | ||
} | ||
case tp: ThisType => // ??? inline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray comment?
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/4156/ to see the changes. Benchmarks is based on merging with master (0c5e39d) |
Triggered by my confusion on scala#4156.
... by inlining two frequently used local methods