Move es6PostTypecheckPasses (including generator transpilation) after checkControlFlow
The main benefit this gives is unreachable code detection in generators. Previously we had to put a uselessCode suppression on transpiled generators so couldn't get any checks.
@@ -426,9 +426,6 @@ public final class DefaultPassConfig extends PassConfig {
checks.add(newTypeInference);
} else {
addOldTypeCheckerPasses(checks, options);
- if (options.needsTranspilationFrom(ES6)) {
- TranspilationPasses.addEs6PostTypecheckPasses(checks);
- }
}
if (options.j2clPassMode.shouldAddJ2clPasses()) {
@@ -441,6 +438,10 @@ public final class DefaultPassConfig extends PassConfig {
checks.add(checkControlFlow);
}
+ if (options.needsTranspilationFrom(ES6) && !options.getNewTypeInference()) {
+ TranspilationPasses.addEs6PostTypecheckPasses(checks);
+ }
+
// CheckAccessControls only works if check types is on.
if (options.isTypecheckingEnabled()
&& (!options.disables(DiagnosticGroups.ACCESS_CONTROLS)
