Skip to content

Commit

Permalink
Propagate untranspilableFeatures suppression tag from stage1 to sta…
Browse files Browse the repository at this point in the history
…ge2 during TypedAST serialize/deserialize

ReportUntranspilableFeatures pass will run in stage2 since it uses languageOut  information. It reports diagnostic {@code UNTRANSPILABLE_FEATURE_PRESENT} that can be supppressed using `untranspilableFeatures` suppression tag. Hence we must propagate those suppressions.

PiperOrigin-RevId: 549451459
  • Loading branch information
rishipal authored and copybara-github committed Jul 19, 2023
1 parent fc210c7 commit 101b758
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public static JSDocInfo convertJSDocInfoForOptimizations(JSDocInfo jsdoc) {
if (jsdoc.getSuppressions().contains("messageConventions")) {
builder.addKind(JsdocTag.JSDOC_SUPPRESS_MESSAGE_CONVENTION);
}
if (jsdoc.getSuppressions().contains("untranspilableFeatures")) {
builder.addKind(JsdocTag.JSDOC_SUPPRESS_UNTRANSPILABLE_FEATURES);
}

OptimizationJsdoc result = builder.build();
if (OptimizationJsdoc.getDefaultInstance().equals(result)) {
Expand Down Expand Up @@ -320,6 +323,15 @@ private static JSTypeExpression createPlaceholderType() {
suppressions.add("messageConventions");
continue;

// ReportUntranspilableFeatures pass will run in stage2 since it uses languageOut
// information. It reports diagnostic {@code UNTRANSPILABLE_FEATURE_PRESENT} that can be
// supppressed using `untranspilableFeatures` suppression tag.
// Hence we must propagate it.
case JSDOC_SUPPRESS_UNTRANSPILABLE_FEATURES:
suppressions = (suppressions != null ? suppressions : new TreeSet<>());
suppressions.add("untranspilableFeatures");
continue;

case JSDOC_FILEOVERVIEW:
builder.recordFileOverview("");
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@ enum JsdocTag {

// Used to identify Sass generated css (.css.closure.js) files.
JSDOC_SASS_GENERATED_CSS_TS = 34;

// Used to suppress warnings by ReportUntranspilableFeatures pass in stage2
JSDOC_SUPPRESS_UNTRANSPILABLE_FEATURES = 36;
}

0 comments on commit 101b758

Please sign in to comment.