Commit Graph

117 Commits

Author SHA1 Message Date
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Jordan Rose
501c1fd31b Replace std::ofstream with llvm::raw_fd_ostream in -verify-apply-fixes (#15133)
This isn't a user-facing feature, but why bother using std::ofstream?
2018-03-10 16:57:41 -08:00
Doug Gregor
29150045f9 Handle DK_Remark 2017-10-13 11:30:52 -07:00
Huon Wilson
a9299802bb Factor out first = true; ... if (first) first = false; else ....
There's an `interleave` function for this: let's use it.
2017-03-10 15:44:12 -08:00
Rintaro Ishizaki
384ab780e9 [Diagnostic verifier] Make '<unknown>' check optional
Added frontend option '-verify-ignore-unknown'
2017-02-02 10:49:32 +09:00
Rintaro Ishizaki
827c6e7c3d [Diagnostic verifier] Diagnostics at '<unknown>:0' are unexpected 2017-02-02 10:48:54 +09:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Hugh Bellamy
4779659f39 Fix warnings building swift/Frontend on Windows using MSVC 2016-12-02 12:50:39 +00:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Jordan Rose
5746671a19 Add -verify-apply-fixes to accompany -verify.
Enables Chris's auto-apply-fixes mode for -verify: if an expected-*
annotation has the wrong message, or if the expected fix-its are
incorrect, this option will **edit the original file** to update them.

This is a tool for compiler developers only; it doesn't affect
normal diagnostic printing or normal fix-its.
2016-09-15 10:38:43 -07:00
Doug Gregor
70f3290252 [Diagnostic verify] Treat "{{none}}" as "no unexpected Fix-Its".
We were using "{{none}}" to mean "no Fix-Its" at all in the diagnostic
verifier, which is useful but narrow. Tweak it's meaning to mean "no
Fix-Its other than the ones we've explicitly checked for", which lets
us verify the exact set of Fix-Its produced as part of a diagnostic
rather than only matching a subset. I'll be landing some tests that
rely on this shortly.
2016-05-26 23:19:11 -07:00
Jordan Rose
0788bf5f5c Revert accidental commit.
...enabling Chris's nifty fix-it updater tool. Now that I've done
it too, maybe I'll put in a frontend flag for it after all.
2016-05-04 14:20:29 -07:00
Jordan Rose
894318cfe0 Allow instance member syntax in @available(renamed:).
Example:

    @available(*, unavailable, renamed: "Sequence.enumerated(self:)")
    func enumerate<Seq: SequenceType>(_ sequence: Seq) ->
        EnumerateSequence<Seq>

This will allow us to reuse this logic to suggest fixes for APIs
turned into members by NS_SWIFT_NAME.
2016-05-04 14:17:15 -07:00
Chris Lattner
860139c09c fix a logic error in the diagnostic verifier: if a fixit was expected but not
produced we'd emit two error messages.  The first complained about the diagnostic
text being wrong and the second complained about the fixit being wrong.

That first one is incorrect to emit and super confusing.  No testcase, since this
only affects -verify mode used by the testsuite.
2016-04-15 14:15:39 -07:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
db13bcb22e Fix typos. 2015-12-26 14:11:42 +01:00
gregomni
db44bf7d69 Add support in the diagnostic verifier for verifying no fix-its
Checked what it would look like to verify fix-its in every case, and
currently the tests are missing expected fix-its in 435 diagnoses in 60
test files.

So as an alternative, added support for a no fix-its marker “{{none}}”, and
added that marker to the c-style for deprecation tests where it applies.
2015-12-22 13:33:39 -08:00
Chris Lattner
f0aa5aa704 revert unintended change.
Swift SVN r32005
2015-09-16 20:17:55 +00:00
Chris Lattner
92fc60f619 fix rdar://22387625 QoI: Common errors: 'let x= 5' and 'let x =5' could use Fix-its
Swift SVN r32004
2015-09-16 20:12:14 +00:00
Chris Lattner
1439bba142 move the special case closure diagnostics to CSDiag out of TypeCheckPattern,
since the logic is specific to it and about to get more-so. NFC.


Swift SVN r31719
2015-09-05 22:13:49 +00:00
Chris Lattner
44b35a85f8 remove a bunch more Failure conditions that CSDiags ignores.
Swift SVN r31718
2015-09-05 21:53:08 +00:00
Chris Lattner
7ad6eaad07 the previous patch improved 22308291 enough to consider it done.
Swift SVN r31697
2015-09-04 22:35:42 +00:00
Chris Lattner
34ae9bb9b6 Fix <rdar://problem/22584076> QoI: Using array literal init with dictionary produces bogus error
This includes a few changes:
 - Enhance diagnoseGeneralConversionFailure to not ignore constraints that are fully solved by
   CSDiags' heuristics.
 - Enhance dictionary/array literals diagnostics to handle non-compliance to their literal 
   protocols with a specific and custom error message.
 - Add specific QoI for turning accidental use of array literals in dictionary context into
   the right dictionary syntax (with a fixit).


Swift SVN r31696
2015-09-04 22:31:21 +00:00
Chris Lattner
eb0131f927 refactor all of the constraint system "Fix" processing logic out of
ConstraintSystem::applySolution into its own helper function to reduce
indentation and make ConstraintSystem::applySolution much more simple
and obvious.  NFC.


Swift SVN r31290
2015-08-18 04:47:34 +00:00
Chris Lattner
1ad24fdfc2 rework how 'as' casts are diagnosed, removing a special case from CSApply and
allowing these failures to hook into other diagnostic goodies (e.g. the
"did you mean to use '!' or '?'?" cases showing in the testsuite).  That said,
by itself this doesn't have a huge impact, but avoids regressions with other
pending changes.


Swift SVN r31289
2015-08-18 04:35:41 +00:00
Chris Lattner
b889fb400d every time I commit this I get closer to doing something about it...
Swift SVN r31265
2015-08-17 16:46:04 +00:00
Chris Lattner
6c3976061c If a contextual type is available when type checking collection literals, use it to
produce specific diagnostics about individual elements being incorrect instead of
complaining about the whole thing in aggregate.

This improves diagnostics immediately, but is also important to unblock future progress.



Swift SVN r31264
2015-08-17 16:41:55 +00:00
Chris Lattner
7f7b78e051 Fix <rdar://problem/22263468> QoI: Not producing specific argument conversion diagnostic for tuple init
Swift SVN r31211
2015-08-13 06:05:03 +00:00
Chris Lattner
616dbb2a5e fix <rdar://problem/22255907> QoI: bad diagnostic if spurious & in argument list
Swift SVN r31206
2015-08-13 05:22:20 +00:00
Chris Lattner
83d6cfcb30 Yet again, didn't mean to check this in...
Swift SVN r31131
2015-08-11 06:06:26 +00:00
Chris Lattner
4b96cba12b Fix <rdar://problem/22143680> QoI: terrible diagnostic when trying to form a generic protocol
Swift SVN r31108
2015-08-10 16:50:45 +00:00
Chris Lattner
92feced290 add some code that causes -verify to error when a fixit was generated, but
not specified in a testcase.  Currently disabled, pending discussion.


Swift SVN r30990
2015-08-04 17:32:55 +00:00
Chris Lattner
7e3146025d fix an off-by-two in the previous patch.
Swift SVN r30983
2015-08-04 05:28:09 +00:00
Chris Lattner
738ccaf054 teach -verify mode to automatically update incorrect fixit requirements when
autoApplyFixes is enabled, because, well, we can.  NFC since noone uses this.



Swift SVN r30982
2015-08-04 05:25:23 +00:00
Chris Lattner
799c366451 Fix some issues where replacing multiple sequential diagnostics
could lead to an "overlapping diagnostics" assertion because
two fixits were zapping whitespace.  NFC, since noone except me
uses this.


Swift SVN r30929
2015-08-02 05:42:17 +00:00
Chris Lattner
5deadfb6e4 didn't mean to comit this...
Swift SVN r30918
2015-08-01 17:37:09 +00:00
Chris Lattner
bdaf954982 when recursively type checking an expression with its contextual type and
other constraints intentionally ripped off, tell the recursive solution that
we can tolerate an ambiguous result.  The point of this walk is not to
produce a concrete type for the subexpression, it is to expose any structural
errors within that subsystem that don't depend on the contextual constraints.


Swift SVN r30917
2015-08-01 17:31:49 +00:00
Chris Lattner
fecf0c06ad teach autoApplyFixes how to remove diagnostics that are no longer produced. NFC since noone uses this.
Swift SVN r30886
2015-07-31 22:33:47 +00:00
Chris Lattner
7851d348a8 merge the ErrorDoesNotHaveInitOnInstance complexity into the normal
"member not found" diagnostic machinery.


Swift SVN r30842
2015-07-31 04:23:07 +00:00
Chris Lattner
50be7e4ecf reapply r30789, r30795, r30796, r30797, without r30787 which causes a compile time hit:
- Produce more specific diagnostics relating to different kinds of invalid
 - add a testcase, nfc
 - Reimplement FailureDiagnosis::diagnoseGeneralMemberFailure in terms of

Not including r30787 means that we still generate bogus diagnostics like:
[1, 2, 3].doesntExist(0)  // expected-error {{type 'Int2048' does not conform to protocol 'IntegerLiteralConvertible'}}

But it is an existing and separable problem from the issues addressed here.



Swift SVN r30819
2015-07-30 23:31:56 +00:00
Chris Lattner
f293e84e04 revert part of my previous patch.
Swift SVN r30797
2015-07-30 06:35:54 +00:00
Chris Lattner
98a445384a Produce more specific diagnostics relating to different kinds of invalid
member references:

- Use of instance members from types
- Use of type members from instances
- Use of mutating getters.

This surely resolves some radars, but I'll have to dig them out later.


Swift SVN r30796
2015-07-30 06:26:43 +00:00
Chris Lattner
d24cb2dfe9 didn't mean to commit this...
Swift SVN r30666
2015-07-26 22:23:25 +00:00
Chris Lattner
66683f94f9 Eliminate the "IsReturnExpr" bit from the AST - it was a poorly maintained
version of the new CTP_ReturnStmt conversion, used to generate return-specific 
diagnostics.  Now that we have a general solution, we can just use that.

This improves diagnostics in returns for accessors, since they were apparently
not getting the bit set.


Swift SVN r30665
2015-07-26 22:05:40 +00:00
Chris Lattner
dc7b13735e didn't mean to commit this
Swift SVN r30652
2015-07-26 05:34:19 +00:00
Chris Lattner
a8d9aec957 revert r30641, it wasn't correct. We produce better diagnostics for the
cases I was worried about anyway now.


Swift SVN r30651
2015-07-26 05:33:33 +00:00
Chris Lattner
3181ea35bd implement the mechanics for -verify mode to auto-apply the fixits it generates,
this isn't wired up to anything yet though.


Swift SVN r30628
2015-07-25 15:52:36 +00:00
Chris Lattner
5e4cd16887 Have -verify mode emit the expected diagnostic text as a fixit to avoid confusing and redundant output,
e.g.:

/Users/sabre/Projects/swiftsource/swift/test/Constraints/existential_metatypes.swift:17:28: error: incorrect message found
pp = pt // expected-error{{cannot assign a value of type 'P.Type' to a value of type 'P.Protocol'}}
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                           'P.Type' is not convertible to 'P.Protocol'



Swift SVN r30626
2015-07-25 15:18:22 +00:00