Commit Graph

13 Commits

Author SHA1 Message Date
Chris Lattner
23b713abed fix typo in diagnostic.
Swift SVN r27873
2015-04-28 17:04:00 +00:00
Chris Lattner
88e50659f7 fix <rdar://problem/17564699> QoI: Structs should get convenience initializers
The diagnostic we were producing was confusing the user into thinking that
you couldn't have a delegating init on a struct.  Improve the diagnostic and
add a fixit hint.



Swift SVN r27872
2015-04-28 17:01:48 +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
Doug Gregor
ece743ea3b Record overrides of convenience initializers.
Even though we don't require the 'override' keyword for convenience
initializers, we still have override semantics for them. This
manifests in, for example, name lookup and ambiguity resolution.


Swift SVN r21696
2014-09-04 05:33:46 +00:00
Doug Gregor
4645d0050b Don't inherit a designated initializer if there is already a convenience initializer with the same signature <rdar://problem/17785840>.
Swift SVN r21075
2014-08-06 21:26:03 +00:00
Doug Gregor
26816e2b8c QoI: Improve diagnostic for a missing required initializer with a Fix-It.
When a subclass is missing a required initializer, produce an error
within the subclass that mentions the required initializer along with
a Fix-It that provides an initializer stub, e.g.,

  required init(coder aDecoder: NSCoder!) {
      fatalError("init(coder:) has not been implemented")
  }

We take care to insert this stub in the main class, after all of the
initializers (if there are any) or near the beginning of the class (if
there aren't any initializers), and try to match the existing
indentation. If this works out, we should handle unsatisfied protocol
requirements the same way. <rdar://problem/17923210>

Swift SVN r21055
2014-08-06 00:33:54 +00:00
Doug Gregor
11d49335d3 Customize diagnostic for calls to super.init within a convenience initializer <rdar://problem/17922223>.
Swift SVN r21046
2014-08-05 22:16:20 +00:00
Doug Gregor
a27179c0bc Don't diagnose the lack of self.init during type checking <rdar://problem/17922223>.
self.init isn't needed if the initializer never returns (e.g., if it
calls fatalError), so let DI diagnostic this. DI doesn't produce as
nice a diagnostic, however.

Swift SVN r21044
2014-08-05 22:00:58 +00:00
Doug Gregor
5fc8ac7fd1 Require the 'override' keyword for initializers that override designated initializers.
Swift SVN r20490
2014-07-24 15:38:33 +00:00
Doug Gregor
4521194e91 Improve diagnostic for missing 'required' initializers.
We have useful DeclNames now; use them.

Swift SVN r20431
2014-07-23 22:16:39 +00:00
Chris Lattner
fe95f81397 introduce a new 'DeclModifier' flag on attributes, which mark that the
attribute is a "modifier" of a decl, not an "attribute" and thus shouldn't
be spelt with an @ sign.  Teach the parser to parse "@foo" but reject it with
a nice diagnostic and a fixit if "foo" is a decl modifier.

Move 'dynamic' over to this (since it simplifies some code), and switch the
@optional and @required attributes to be declmodifiers (eliminating their @'s).



Swift SVN r19787
2014-07-10 05:49:10 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Doug Gregor
571ae697d5 Parsing and AST support for complete object initializers.
Enforce that complete object initializers always be delegating.

Swift SVN r14549
2014-03-01 00:51:18 +00:00