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