Skip to content

Commit 4bacc25

Browse files
committed
Refine levels computation
An import now has the same precedence as a current import and definition only if both contexts have the same owner. Imports nested in inner owners do shadow definitions and imports in outer ones.
1 parent 787baa4 commit 4bacc25

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ object Implicits:
307307
*/
308308
override val level: Int =
309309
if outerImplicits == null then 1
310-
else if isImport
310+
else if isImport && (irefCtx.owner eq outerImplicits.irefCtx.owner)
311311
|| migrateTo3(using irefCtx)
312312
|| (irefCtx.owner eq outerImplicits.irefCtx.owner)
313313
&& (irefCtx.scope eq outerImplicits.irefCtx.scope)

0 commit comments

Comments
 (0)