cljs.analyzer/infer-type pass infers tag with incorrect priority
Key details
Description
I tracked down an issue related to externs inference and found the culprit to be in the infer-type analyzer pass.
This will be picked up by :infer-externs correctly.
This won't be. The tag will be ignored.
I tracked this down to cljs.analyzer/get-tag. Since the binding is destructured it is already tagged as clj, found in :info. This causes it to never look at the form itself and discard the explicit tag.
I believe that any tag on the form itself should always win.
Changing the lookup order accordingly fixes the missing externs issue.
I'm not 100% confident my solution is correct here. :tag is handled quite differently in several places, some set it explicitly some let the infer-type pass find it.
I tracked down an issue related to externs inference and found the culprit to be in the infer-type analyzer pass.
This will be picked up by :infer-externs correctly.
This won't be. The tag will be ignored.
I tracked this down to
cljs.analyzer/get-tag. Since the binding is destructured it is already tagged asclj, found in:info. This causes it to never look at the form itself and discard the explicit tag.I believe that any tag on the form itself should always win.
Changing the lookup order accordingly fixes the missing externs issue.
I'm not 100% confident my solution is correct here.
:tagis handled quite differently in several places, some set it explicitly some let the infer-type pass find it.No clue how to write a test for this.