Skip to content

Commit 895a47c

Browse files
committed
Fix logic and comment for hasImport
1 parent 51498d2 commit 895a47c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,11 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
277277
*
278278
* import owner.feature
279279
*
280-
* (the feature may be bunched with others, or renamed, but wildcard imports
281-
* don't count).
280+
* and there is no visible nested import that excludes the feature, as in
281+
*
282+
* import owner.{ feature => _ }
283+
*
284+
* The feature may be bunched with others, or renamed, but wildcard imports don't count.
282285
*
283286
* 2. The feature is enabled by a compiler option
284287
*
@@ -296,8 +299,8 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
296299
if (ctx.importInfo eq null) false
297300
else {
298301
val isImportOwner = ctx.importInfo.site.widen.typeSymbol eq owner
299-
if (isImportOwner && ctx.importInfo.excluded.contains(feature)) false
300-
else if (isImportOwner && ctx.importInfo.originals.contains(feature)) true
302+
if (isImportOwner && ctx.importInfo.originals.contains(feature)) true
303+
else if (isImportOwner && ctx.importInfo.excluded.contains(feature)) false
301304
else {
302305
var c = ctx.outer
303306
while (c.importInfo eq ctx.importInfo) c = c.outer

0 commit comments

Comments
 (0)