Error spans of unused imports could be improved
Example:
compiler/codeGen/StgCmmExpr.hs:44:1: warning: [-Wunused-imports]
The import of ‘primRepSlot’ from module ‘RepType’ is redundant
|
44 | import RepType ( isVoidTy, countConRepArgs, primRepSlot )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
compiler/codeGen/StgCmmExpr.hs:53:1: warning: [-Wunused-imports]
The import of ‘Data.Function’ is redundant
except perhaps to import instances from ‘Data.Function’
To import instances alone, use: import Data.Function()
|
53 | import Data.Function ( on )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Second error message is fine, but in the first one the span looks as if the whole import line is the problem. I think a better error would be:
compiler/codeGen/StgCmmExpr.hs:44:54: warning: [-Wunused-imports]
The import of ‘primRepSlot’ from module ‘RepType’ is redundant
|
44 | import RepType ( isVoidTy, countConRepArgs, primRepSlot )
| ^^^^^^^^^^^
Now it's clear that only the primRepSlot
part is the problem.
(Note that in the "improved" error message I also updated the "column" part of the location)