diff options
author | Martin Odersky <odersky@gmail.com> | 2013-07-19 16:11:10 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-07-19 17:02:03 +0200 |
commit | ea640a32264cb78efbf267d5c2be89e3e99dcccf (patch) | |
tree | e4c3103d9d08580d9ef478763fb52c80548feef8 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 17ef71dc2b11c5d1a82307f79d50c7ed0f77fd81 (diff) | |
download | dotty-ea640a32264cb78efbf267d5c2be89e3e99dcccf.tar.gz dotty-ea640a32264cb78efbf267d5c2be89e3e99dcccf.tar.bz2 dotty-ea640a32264cb78efbf267d5c2be89e3e99dcccf.zip |
Additions needed to support implicits.
Still to do:
- properly account for bounded wildcard types
- set up scheme for nested diagnostics buffers.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 23 |
1 files changed, 9 insertions, 14 deletions
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) } |