wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
226 stars 28 forks source link

fix unused import warning with configured packages #1000

Closed Jampi0n closed 3 years ago

Jampi0n commented 3 years ago

When only configured functions (functions that are overridden by the config package) are used, Wurst will consider the configured package unused. In other cases, the function is not considered to be unused, but will be attributed to the wrong package, resulting in "the import ... can be removed, because it is already included in ...".

This can be fixed by implicitly adding the configured package to the used packages, when the config package is used.

A prime example is the ErrorHandling package. In most cases, only the configurable error function is used, so when this function is configured most packages that import ErrorHandling will throw a warning.

Frotty commented 3 years ago

Is this related to https://github.com/wurstscript/WurstScript/issues/990 or something different?

Jampi0n commented 3 years ago

Not related.

Frotty commented 3 years ago

Ideally add a test for this