Open vobruba-martin opened 8 years ago
You're right, there is a bug in the old type checker; there should be a warning in the 2nd example. This works correctly in the new type checker.
I recommend trying out to the new one, with the flag --new_type_inf. It finds many more warnings than the old one.
Is this new type checker stable? I get many weird errors using it for my project but I couldn't reproduce them using simpler code. Is there any chance that old type checker will be fixed?
It's mature enough for projects to use it, but it's still under development. Most work that goes in the old type checker is fixing crashes (and the recent @record work). Other bugs won't be fixed.
I can probably give you some guidance to get you started with the new type checker. If you can't reproduce warnings with a small independent code sample, start a new thread here: https://groups.google.com/forum/#!forum/closure-compiler-discuss And post the most common warnings that you see, with snippets from your actual project. It doesn't matter that I won't be able to reproduce, maybe the snippets will contain enough information for me to give you some help.
Also, this page can help you get started: https://github.com/google/closure-compiler/wiki/Using-NTI-(new-type-inference)
I don't think it is a bug in the OTI per se. I think that when the new short syntax was introduced, the type info the OTI is using wasn't updated, as the traditional syntax works correctly:
I use ADVANCED optimization and I expect both scripts to raise a warning because of bad callFn argument.
This script raises a warning:
This does not (fnToCall inlined):