@@ -178,6 +178,20 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
178
178
previous
179
179
}
180
180
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
+
181
195
/** The type representing a named import with enclosing name when imported
182
196
* from given `site` and `selectors`.
183
197
*/
@@ -193,25 +207,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
193
207
found
194
208
}
195
209
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))
208
212
209
213
selector match {
210
214
case Thicket (fromId :: Ident (Name ) :: _) =>
211
215
val Ident (from) = fromId
212
- selection (if (name.isTypeName) from.toTypeName else from)
216
+ unambiguousSelection (if (name.isTypeName) from.toTypeName else from)
213
217
case Ident (Name ) =>
214
- selection (name)
218
+ unambiguousSelection (name)
215
219
case _ =>
216
220
recur(rest)
217
221
}
@@ -224,18 +228,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
224
228
/** The type representing a wildcard import with enclosing name when imported
225
229
* from given import info
226
230
*/
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
239
235
240
236
/** Is (some alternative of) the given predenotation `denot`
241
237
* defined in current compilation unit?
0 commit comments