I’ve been working on improving RemoveUnusedImports to handle imports inside conditional compilation blocks as discussed in #2335. I’m planning to expand the test coverage around this behaviour, and this thread is intended to gather feedback on which scenarios are worth covering.
I’m currently considering tests for:
-
Removing imports from active
#ifclauses -
Not removing imports from inactive
#if/#elseifclauses -
Ignoring imports inside
#if falseblocks -
Treating imports inside
#if truelike top-level imports -
Mixed top-level and conditional imports
-
Nested inactive conditional regions
I’ve started prototyping support for active #if clauses in this PR: PR of the tests.
Would appreciate any guidance on which of these cases should be included.