of providing contextual diagnostics (e.g. producing the warning in
Constraints/dynamic_lookup.swift). This drops a specific diagnostic about
force casting the result of as! which was added in the Swift 1.2 timeframe
to explain the change in cast semantics. Now that as! has been around for
a long time, it is more confusing than helpful.
Swift SVN r31887
Now for:
let req = NSURLRequest(URL: NSURL(string: "<some url>")!)?
instead of producing:
test.swift:2:58: error: could not find an overload for 'init' that accepts the supplied
we produce the correct diagnostic, with a fixit:
error: cannot use optional chaining on non-optional value of type 'NSURLRequest'
let req = NSURLRequest(URL: NSURL(string: "<some url>")!)?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
This also consolidates some existing diagnostics to improve their wording.
Swift SVN r30049
this is neutral w.r.t. diagnostics quality, but deletes a ton
of code:
include/swift/AST/DiagnosticsSema.def | 21 ++---------
lib/Sema/CSDiag.cpp | 64 ++--------------------------------
2 files changed, 9 insertions(+), 76 deletions(-)
Swift SVN r28956
that make vardecls and subscripts immutable. This makes the indirect cases
a lot more specific ("this is a get-only property" instead of "this is
immutable") and allows us to consolidate a bunch of code:
2 files changed, 45 insertions(+), 119 deletions(-)
Swift SVN r28954
As far as I know, the compiler now only produces the useless "cannot
assign to the result of this expression" diagnostic in cases that don't
make sense to be an lvalue, like "4 = x".
Swift SVN r28935
into account accesibility, assignments to self in a non-mutating
method (consistently), recursive components of an lvalue that makes it
non-settable, etc. Now we tell you what the *problem* was, instead of
just whining.
This fixes:
<rdar://problem/19370429> QoI: fixit to add "mutating" when assigning to a member of self in a struct
<rdar://problem/17632908> QoI: Modifying struct member in non-mutating function produces difficult to understand error message
in their full generality.
Swift SVN r28867
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK. The driver was defaulting to the
host OS. Thus, we could not run the tests when the standard library was
not built for OS X.
Swift SVN r24504
Previously the "as" keyword could either represent coercion or or forced
downcasting. This change separates the two notions. "as" now only means
type conversion, while the new "as!" operator is used to perform forced
downcasting. If a program uses "as" where "as!" is called for, we emit a
diagnostic and fixit.
Internally, this change removes the UnresolvedCheckedCastExpr class, in
favor of directly instantiating CoerceExpr when parsing the "as"
operator, and ForcedCheckedCastExpr when parsing the "as!" operator.
Swift SVN r24253
Create a new "OptionalObject" constraint kind in the solver that relates an optional type to its payload type, preserving lvalue-ness, and use it to model ForceValueExpr under the optional-lvalues regime.
Swift SVN r20140