Skip to content

Commit 82290c8

Browse files
committed
Fix unused imports in import stmt
1 parent b2f0fa1 commit 82290c8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class CheckUnused extends Phase:
6969
tree match
7070
case imp:tpd.Import =>
7171
unusedDataApply(_.registerImport(imp))
72+
traverseChildren(tree)(using newCtx)
7273
case ident: Ident =>
7374
unusedDataApply(_.registerUsed(ident.symbol))
7475
traverseChildren(tree)(using newCtx)

tests/neg-custom-args/fatal-warnings/i15503a.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,14 @@ object testAnnotatedType:
203203
import annotation.switch // OK
204204
val a = (??? : @switch) match
205205
case _ => ???
206+
207+
208+
//-------------------------------------
209+
package testImportsInImports:
210+
package a:
211+
package b:
212+
val x = 1
213+
package c:
214+
import a.b // OK
215+
import b.x // OK
216+
val y = x

0 commit comments

Comments
 (0)