Union cases are one area where DCE could be improved. At the least, no union case constructor for unused cases.
Far more tricky would be is to actually trim match expressions that cleanly match union cases too, and track their dependencies separately, so even more code can be eliminated around unused cases. If this could happen, we would not need things like the refactoring we made around UI templating to avoid pulling in MathJS when not needed - we had to convert a union to an abstract class, and all matches on it into abstract methods so that code belonging to "cases" (now subtypes) can be cleanly cut out by current DCE that works at method level only
Union cases are one area where DCE could be improved. At the least, no union case constructor for unused cases.
Far more tricky would be is to actually trim match expressions that cleanly match union cases too, and track their dependencies separately, so even more code can be eliminated around unused cases. If this could happen, we would not need things like the refactoring we made around UI templating to avoid pulling in MathJS when not needed - we had to convert a union to an abstract class, and all matches on it into abstract methods so that code belonging to "cases" (now subtypes) can be cleanly cut out by current DCE that works at method level only