We're updating the issue view to help you get more done. 

Warn on type hint mismatch with inferred

Description

If you have code like

1 (let [^string x 3] )

we would generally prefer the type hint over the inferred type. But in cases where we have inferred a type and the type is inconsistent with the type hint, it may be useful to emit a diagnostic in that case.

If the inferred type is a superset of the hint, then we shouldn't warn. For example, if we infer any then no warning should be emitted. Also, if, for example we infer #{clj-nil string} and we have a hint of string we can take the stance that the developer is essentially saying that clj-nil can't happen.

But, on the other hand, if we infer number and there is a hint of string then clearly something is amiss.

Environment

None

Status

Assignee

Unassigned

Reporter

Mike Fikes

Labels

None

Approval

None

Patch

None

Priority

Major