google / google/closure-compiler

closure-compiler skips type checks if output language level is higher than the type checker understands

Open
#3,016 10 comments 0 reactions 0 assignees View on GitHub
triage-done
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Create the following `main.js`:

```
/** @return {string} */
var main = function() { return 2; };
```

And run the following commandline:

```
java -jar closure-compiler-v20180610.jar --js main.js --jscomp_error checkTypes --language_in ECMASCRIPT_2017 --language_out ECMASCRIPT_2017
```

Expectation:
closure-compiler should fail with a type error "inconsistent return type"

Actual:
closure-compiler prints `WARNING: Skipping pass checkTypes` (!!!) but otherwise passes successfully

Note that this works as expected if you pass `--language_out ECMASCRIPT5`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.