Skip to content

Commit 9cc595c

Browse files
lauraharkercopybara-github
authored andcommitted
Never suppress unrecognized type errors for goog.provide/goog.module namespaces
Currently if running the compiler in a mode that sorts or prunes unused dependencies, all goog.module & goog.provide namespaces are "forward declared", so the compiler won't report unrecognized type errors for those namespaces. This is unnecessary and confusing so we're removing it. PiperOrigin-RevId: 515375398
1 parent 496a651 commit 9cc595c

File tree

2 files changed

+0
-36
lines changed

2 files changed

+0
-36
lines changed

src/com/google/javascript/jscomp/Compiler.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,14 +2044,6 @@ void orderInputs() {
20442044
// Check if the sources need to be re-ordered.
20452045
boolean staleInputs = false;
20462046
if (options.getDependencyOptions().needsManagement()) {
2047-
for (CompilerInput input : moduleGraph.getAllInputs()) {
2048-
// Forward-declare all the provided types, so that they
2049-
// are not flagged even if they are dropped from the process.
2050-
for (String provide : input.getProvides()) {
2051-
forwardDeclareType(provide);
2052-
}
2053-
}
2054-
20552047
try {
20562048
moduleGraph.manageDependencies(this, options.getDependencyOptions());
20572049
staleInputs = true;

test/com/google/javascript/jscomp/CommandLineRunnerTest.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,34 +1326,6 @@ public void testDependencySortingWhitespaceMode() {
13261326
});
13271327
}
13281328

1329-
@Test
1330-
public void testForwardDeclareDroppedTypes() {
1331-
args.add("--dependency_mode=PRUNE_LEGACY");
1332-
1333-
args.add("--warning_level=VERBOSE");
1334-
test(
1335-
new String[] {
1336-
lines(
1337-
"/** @externs */", //
1338-
new TestExternsBuilder().addClosureExterns().build()),
1339-
"goog.require('beer');",
1340-
"goog.provide('beer'); /** @param {Scotch} x */ function f(x) {}",
1341-
"goog.provide('Scotch'); var x = 3;"
1342-
},
1343-
new String[] {"var beer = {}; function f(a) {}", ""});
1344-
1345-
test(
1346-
new String[] {
1347-
lines(
1348-
"/** @externs */", //
1349-
new TestExternsBuilder().addClosureExterns().build()),
1350-
"goog.require('beer');",
1351-
"goog.provide('beer'); /** @param {Scotch} x */ function f(x) {}"
1352-
},
1353-
new String[] {"var beer = {}; function f(a) {}", ""},
1354-
RhinoErrorReporter.UNRECOGNIZED_TYPE_ERROR);
1355-
}
1356-
13571329
@Test
13581330
public void testOnlyClosureDependenciesEmptyEntryPoints() throws Exception {
13591331
// Prevents this from trying to load externs.zip

0 commit comments

Comments
 (0)