@@ -253,14 +253,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
253
253
! noImports &&
254
254
(prevPrec < prec || prevPrec == prec && (prevCtx.scope eq ctx.scope))
255
255
256
- @ tailrec def loop (implicit ctx : Context ): Type = {
256
+ @ tailrec def loop (lastCtx : Context )( implicit ctx : Context ): Type = {
257
257
if (ctx.scope == null ) previous
258
258
else {
259
- val outer = ctx.outer
260
259
var result : Type = NoType
261
260
262
261
// find definition
263
- if ((ctx.scope ne outer .scope) || (ctx.owner ne outer .owner)) {
262
+ if ((lastCtx eq ctx) || (ctx .scope ne lastCtx .scope) || (ctx.owner ne lastCtx .owner)) {
264
263
val defDenot = ctx.denotNamed(name)
265
264
if (qualifies(defDenot)) {
266
265
val curOwner = ctx.owner
@@ -275,13 +274,14 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
275
274
if (defDenot.symbol is Package )
276
275
result = checkNewOrShadowed(previous orElse found, packageClause)
277
276
else if (prevPrec < packageClause)
278
- result = findRef(found, packageClause, ctx)(outer)
277
+ result = findRef(found, packageClause, ctx)(ctx. outer)
279
278
}
280
279
}
281
280
}
282
281
283
282
if (result.exists) result
284
283
else { // find import
284
+ val outer = ctx.outer
285
285
val curImport = ctx.importInfo
286
286
def updateUnimported () =
287
287
if (curImport.unimported.exists) unimported += curImport.unimported
@@ -297,20 +297,21 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
297
297
findRef(checkNewOrShadowed(wildImp, wildImport), wildImport, ctx)(outer)
298
298
else {
299
299
updateUnimported()
300
- loop(outer)
300
+ loop(ctx)( outer)
301
301
}
302
302
}
303
303
else {
304
304
updateUnimported()
305
- loop(outer)
305
+ loop(ctx)( outer)
306
306
}
307
307
}
308
- else loop(outer)
308
+ else loop(ctx)( outer)
309
309
}
310
310
}
311
311
}
312
312
313
- loop
313
+ // begin findRef
314
+ loop(ctx)(ctx)
314
315
}
315
316
316
317
// begin typedIdent
0 commit comments