@@ -178,6 +178,20 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
178178 previous
179179 }
180180
181+ def selection (imp : ImportInfo , name : Name ) =
182+ if (imp.sym.isCompleting) {
183+ ctx.warning(i " cyclic ${imp.sym}, ignored " , tree.pos)
184+ NoType
185+ } else if (unimported.nonEmpty && unimported.contains(imp.site.termSymbol))
186+ NoType
187+ else {
188+ val pre = imp.site
189+ val denot = pre.member(name).accessibleFrom(pre)(refctx)
190+ // Pass refctx so that any errors are reported in the context of the
191+ // reference instead of the
192+ if (reallyExists(denot)) pre.select(name, denot) else NoType
193+ }
194+
181195 /** The type representing a named import with enclosing name when imported
182196 * from given `site` and `selectors`.
183197 */
@@ -193,25 +207,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
193207 found
194208 }
195209
196- def selection (name : Name ) =
197- if (imp.sym.isCompleting) {
198- ctx.warning(i " cyclic ${imp.sym}, ignored " , tree.pos)
199- NoType
200- }
201- else if (unimported.nonEmpty && unimported.contains(imp.site.termSymbol))
202- NoType
203- else {
204- // Pass refctx so that any errors are reported in the context of the
205- // reference instead of the
206- checkUnambiguous(selectionType(imp.site, name, tree.pos)(refctx))
207- }
210+ def unambiguousSelection (name : Name ) =
211+ checkUnambiguous(selection(imp, name))
208212
209213 selector match {
210214 case Thicket (fromId :: Ident (Name ) :: _) =>
211215 val Ident (from) = fromId
212- selection (if (name.isTypeName) from.toTypeName else from)
216+ unambiguousSelection (if (name.isTypeName) from.toTypeName else from)
213217 case Ident (Name ) =>
214- selection (name)
218+ unambiguousSelection (name)
215219 case _ =>
216220 recur(rest)
217221 }
@@ -224,18 +228,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
224228 /** The type representing a wildcard import with enclosing name when imported
225229 * from given import info
226230 */
227- def wildImportRef (imp : ImportInfo )(implicit ctx : Context ): Type = {
228- if (imp.isWildcardImport) {
229- val pre = imp.site
230- if (! unimported.contains(pre.termSymbol) &&
231- ! imp.excluded.contains(name.toTermName) &&
232- name != nme.CONSTRUCTOR ) {
233- val denot = pre.member(name).accessibleFrom(pre)(refctx)
234- if (reallyExists(denot)) return pre.select(name, denot)
235- }
236- }
237- NoType
238- }
231+ def wildImportRef (imp : ImportInfo )(implicit ctx : Context ): Type =
232+ if (imp.isWildcardImport && ! imp.excluded.contains(name.toTermName) && name != nme.CONSTRUCTOR )
233+ selection(imp, name)
234+ else NoType
239235
240236 /** Is (some alternative of) the given predenotation `denot`
241237 * defined in current compilation unit?
0 commit comments