rescript-association / genType

Auto generation of idiomatic bindings between Reason and JavaScript: either vanilla or typed with TypeScript/FlowType.

Home Page:https://rescript-lang.org/docs/gentype/latest/introduction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[DCE] Consider eliminating values in implementation too.

cristianoc opened this issue · comments

When a dead value is removed in an interface (when an interface exists), does it help the compiler if the value is removed from the implementation too? Or does the compiler perform the elimination already?

Indeed they are not removed by ocamlopt.
E.g. compiling this file generates lots of dead code: https://gist.github.com/cristianoc/36929feda4695b0322039eb48189186f

This requires having a dependency edge from the declaration of an id in the implementation, to the corresponding id declaration in the interface.
Also, id declarations in the implementation should be added to the global table, and marked in a special way. No reporting should happen on ids dead in the implementation, but if the id is also dead in the interface, then dead annotations should be added to both the interface and the implementation.