Skip to content

Commit

Permalink
I don't understand
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Jul 14, 2023
1 parent 1892d65 commit 3c07ab5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
* @param prevCtx the context in which the reference was found
* @param using_Context the outer context of `precCtx`
*/
def checkImportAlternatives(previous: Type, prevPrec: BindingPrec, prevCtx: Context)(using Context): Type =
def checkImportAlternatives(previous: Type, prevPrec: BindingPrec, prevCtx: Context, n: Int)(using Context): Type =

def addAltImport(altImp: TermRef) =
if !TypeComparer.isSameRef(previous, altImp)
Expand All @@ -268,16 +268,16 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
if prevPrec == WildImport then
// Discard all previously found references and continue with `altImp`
altImports.clear()
checkImportAlternatives(altImp, NamedImport, ctx)(using ctx.outer)
checkImportAlternatives(altImp, NamedImport, ctx, 1)(using ctx.outer)
else
addAltImport(altImp)
checkImportAlternatives(previous, prevPrec, prevCtx)(using ctx.outer)
checkImportAlternatives(previous, prevPrec, prevCtx, 2)(using ctx.outer)
case _ =>
if prevPrec == WildImport then
wildImportRef(curImport) match
case altImp: TermRef => addAltImport(altImp)
case _ =>
checkImportAlternatives(previous, prevPrec, prevCtx)(using ctx.outer)
checkImportAlternatives(previous, prevPrec, prevCtx, 3)(using ctx.outer)
else
val found = findRefRecur(previous, prevPrec, prevCtx)
if found eq previous then checkNewOrShadowed(found, prevPrec)(using prevCtx)
Expand Down Expand Up @@ -495,11 +495,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
else if (isPossibleImport(NamedImport) && (curImport nen outer.importInfo)) {
val namedImp = namedImportRef(curImport.uncheckedNN)
if (namedImp.exists)
checkImportAlternatives(namedImp, NamedImport, ctx)(using outer)
checkImportAlternatives(namedImp, NamedImport, ctx, 4)(using outer)
else if (isPossibleImport(WildImport) && !curImport.nn.importSym.isCompleting) {
val wildImp = wildImportRef(curImport.uncheckedNN)
if (wildImp.exists)
checkImportAlternatives(wildImp, WildImport, ctx)(using outer)
checkImportAlternatives(wildImp, WildImport, ctx, 5)(using outer)
else {
updateUnimported()
loop(ctx)(using outer)
Expand Down

0 comments on commit 3c07ab5

Please sign in to comment.