From ea640a32264cb78efbf267d5c2be89e3e99dcccf Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 19 Jul 2013 16:11:10 +0200 Subject: Additions needed to support implicits. Still to do: - properly account for bounded wildcard types - set up scheme for nested diagnostics buffers. --- src/dotty/tools/dotc/typer/Typer.scala | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 1dd49ca9f..3054ba9cd 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -167,21 +167,16 @@ class Typer extends Namer with Applications with Implicits { } /** The type representing a wildcard import with enclosing name when imported - * from given `site` and `selectors`. + * from given import info */ - def wildImportRef(site: Type, selectors: List[untpd.Tree]): Type = { - def wildPermitted(selectors: List[untpd.Tree]): Boolean = selectors match { - case Trees.Pair(Trees.Ident(`name`), Trees.Ident(nme.WILDCARD)) :: _ => false - case Trees.Ident(nme.WILDCARD) :: _ => true - case _ :: rest => wildPermitted(rest) - case nil => false - } - if (wildPermitted(selectors)) { - val denot = site.member(name) - if (denot.exists) return NamedType(site, name).withDenot(denot) + def wildImportRef(imp: ImportInfo): Type = + if (imp.wildcardImport && !(imp.excluded contains name.toTermName)) { + val pre = imp.site + val denot = pre.member(name) + if (denot.exists) return NamedType(pre, name).withDenot(denot) + else NoType } - NoType - } + else NoType /** Is (some alternative of) the given predenotation `denot` * defined in current compilation unit? @@ -213,7 +208,7 @@ class Typer extends Namer with Applications with Implicits { if (namedImp.exists) return findRef(checkNewOrShadowed(namedImp, namedImport), namedImport, ctx)(outer) if (prevPrec < wildImport) { - val wildImp = wildImportRef(curImport.site, curImport.selectors) + val wildImp = wildImportRef(curImport) if (wildImp.exists) return findRef(checkNewOrShadowed(wildImp, wildImport), wildImport, ctx)(outer) } -- cgit v1.2.3