Warn on type hint mismatch with inferred


  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:


If you have code like

(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.


There are no comments yet on this issue.


Vote (0)
Watch (0)


  • Created: