Commits
Chris Lattner committed 7c480811975
Diagnose cases where we infer a variable to () or AnyObject type. This is
likely to be a bug (e.g. calling a function when you're looking to get a closure
in the first case, missing a type case in the second case). We emit a note saying
that the warning can be silenced by adding an explicit type, e.g.:
t.swift:4:5: warning: variable 'x' inferred to have type '()', which may be unexpected
var x = print("")
^
t.swift:4:5: note: add an explicit type annotation to silence this warning
var x = print("")
^
: ()
t.swift:7:5: warning: variable 'b' inferred to have type 'AnyObject', which may be unexpected
var b = a
^
t.swift:7:5: note: add an explicit type annotation to silence this warning
var b = a
^
: AnyObject
This implements:
<rdar://problem/15263687> Diagnose variables inferenced to 'AnyObject'
<rdar://problem/16252090> Warning when inferring empty tuple type for declarations
Swift SVN r14811