@@ -976,6 +976,7 @@ trait Implicits:
976
976
*/
977
977
def inferImplicit (pt : Type , argument : Tree , span : Span )(using Context ): SearchResult =
978
978
trace(s " search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}" , implicits, show = true ) {
979
+ Stats .trackTime(" inferImplicit ms" ) {
979
980
record(" inferImplicit" )
980
981
assert(ctx.phase.allowsImplicitSearch,
981
982
if (argument.isEmpty) i " missing implicit parameter of type $pt after typer "
@@ -1015,12 +1016,12 @@ trait Implicits:
1015
1016
}
1016
1017
// If we are at the outermost implicit search then emit the implicit dictionary, if any.
1017
1018
ctx.searchHistory.emitDictionary(span, result)
1018
- }
1019
+ }}
1019
1020
1020
1021
/** Try to typecheck an implicit reference */
1021
1022
def typedImplicit (cand : Candidate , pt : Type , argument : Tree , span : Span )(using Context ): SearchResult = trace(i " typed implicit ${cand.ref}, pt = $pt, implicitsEnabled == ${ctx.mode is ImplicitsEnabled }" , implicits, show = true ) {
1022
1023
if ctx.run.isCancelled then NoMatchingImplicitsFailure
1023
- else
1024
+ else Stats .trackTime( " typed implicit ms " ) {
1024
1025
record(" typedImplicit" )
1025
1026
val ref = cand.ref
1026
1027
val generated : Tree = tpd.ref(ref).withSpan(span.startPos)
@@ -1083,7 +1084,7 @@ trait Implicits:
1083
1084
if (cand.isExtension) Applications .ExtMethodApply (adapted)
1084
1085
else adapted
1085
1086
SearchSuccess (returned, ref, cand.level)(ctx.typerState, ctx.gadt)
1086
- }
1087
+ }}
1087
1088
1088
1089
/** An implicit search; parameters as in `inferImplicit` */
1089
1090
class ImplicitSearch (protected val pt : Type , protected val argument : Tree , span : Span )(using Context ):
@@ -1299,8 +1300,14 @@ trait Implicits:
1299
1300
1300
1301
private def searchImplicit (contextual : Boolean ): SearchResult =
1301
1302
val eligible =
1302
- if contextual then ctx.implicits.eligible(wildProto)
1303
- else implicitScope(wildProto).eligible
1303
+ if contextual then
1304
+ Stats .trackTime(" contextual eligible ms" ) {
1305
+ ctx.implicits.eligible(wildProto)
1306
+ }
1307
+ else
1308
+ Stats .trackTime(" implicit scope eligible ms" ) {
1309
+ implicitScope(wildProto).eligible
1310
+ }
1304
1311
searchImplicit(eligible, contextual) match
1305
1312
case result : SearchSuccess =>
1306
1313
result
0 commit comments