Commit Graph

18 Commits

Author SHA1 Message Date
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Chris Lattner
f8c6e46e03 remove the Failure::IsNotOptional failure mode, as CSDiags does a better job
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
2015-09-11 04:40:13 +00:00
Chris Lattner
ada5487153 add fixit tests to random other tests.
Swift SVN r31006
2015-08-04 20:35:36 +00:00
Chris Lattner
487e0c058b Fix the rest of <rdar://problem/20409366> Diagnostics for init calls should print the class name
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
2015-07-10 01:11:15 +00:00
Chris Lattner
cf1cb14205 recommit 28958/28959, there was a testcase that didn't get updated correctly
but it was between the two revisions.


Swift SVN r28964
2015-05-23 15:50:16 +00:00
Ted Kremenek
b4b81ff657 Revert "merge assignments to UnresolvedDotExpr onto the common path,"
Backing out to fix the build.

Swift SVN r28959
2015-05-23 07:55:07 +00:00
Chris Lattner
3b64718b89 merge assignments to UnresolvedDotExpr onto the common path,
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
2015-05-23 05:18:59 +00:00
Chris Lattner
d5f68b478f Teach the recursive part of the diagnostics to handle the various things
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
2015-05-23 04:53:08 +00:00
Chris Lattner
012cfa8657 Improve mutability diagnostics when the top level is a ForceValueExpr.
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
2015-05-22 21:19:27 +00:00
Chris Lattner
8853d19c2b Dramatically improve the diagnostics when a store is invalid, by taking
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
2015-05-21 05:53:36 +00:00
Chris Lattner
7ff1e80dac make these error message checks more specific, NFC.
Swift SVN r28856
2015-05-20 23:04:18 +00:00
Chris Lattner
29128d0d46 two testcase updates that went with r28854
Swift SVN r28855
2015-05-20 22:59:23 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
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
2015-01-19 06:52:49 +00:00
Chris Willmore
03a6190a1f <rdar://problem/19031957> Change failable casts from "as" to "as!"
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
2015-01-08 00:33:59 +00:00
Doug Gregor
1a8f5e1eec Remove -enable-optional-lvalues and its language option; they're always on anyway.
Swift SVN r21356
2014-08-21 15:53:31 +00:00
Joe Groff
8e757bd21f Sema: Diagnose OptionalObject constraint failures.
Don't regress error reporting when optional lvalues are enabled and OptionalObject constraints fail.

Swift SVN r20229
2014-07-20 18:16:38 +00:00
Joe Groff
4155d52323 Sema: Preserve lvalue-ness through implicit forces of IUOs.
Swift SVN r20209
2014-07-19 17:11:21 +00:00
Joe Groff
ed88875794 Sema: Propagate lvalue-ness through the postfix ! operator.
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
2014-07-18 04:37:00 +00:00