ClojureScript

Warn on type hint mismatch with inferred

Details

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

Description

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.

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: