Pavel Yaskevich
17d46d13eb
[Diagnostics] NFC: Make sure that requirement kind matches locator
...
When constructing requirement failures make sure that requirement
kind provided by the caller matches information about requirement
stored in the locator.
2018-10-24 18:20:27 -07:00
Pavel Yaskevich
70d9b2dfa3
[CSDiagnostics] Fix requirement source lookup to support initializers
...
Resolves: rdar://problem/45470505
2018-10-22 18:32:32 -07:00
gregomni
b7df1ca1df
Re-try a failingConstraint during salvage now that attemptFixes is turned on. This enables better missing conforms-to diagnoses.
2018-10-13 20:06:19 -07:00
Pavel Yaskevich
27d0d26222
Revert "[CSDiagnostics] Don't mention special names in requirement diagnostics"
2018-09-21 14:44:04 -07:00
Pavel Yaskevich
02d5401499
[CSDiagnostics] Don't mention special names in requirement diagnostics
...
Instead of `initializer 'init' of ...` diagnostic should only
mention kind e.g. `initializer of ...` of the declaration
with a special name.
2018-09-21 00:35:21 -07:00
Pavel Yaskevich
bba7112506
[Diagnostics] NFC: Refactor assignment diagnostics into AssignmentFailure
...
Merge logic from `diagnoseAssignmentFailure` and `diagnoseSubElementFailure`
into new `AssignmentFailure`, together with their support functions, which
decouples `CSDiagnostics` from `CSDiag` and scrubs latter from some functionality.
2018-08-27 00:35:44 -07:00
Greg Titus
c95cfc6f69
Merge pull request #18950 from gregomni/rvalue-as-lvalue
...
[Diagnostics] Adding assignments directly to CS and diagnosing from there.
2018-08-26 11:12:57 -07:00
Pavel Yaskevich
7dda51bb81
[Diagnostics] Transform tryDiagnoseTrailingClosureAmbiguity into a failure
2018-08-25 00:19:41 -07:00
gregomni
821f63fe98
Make assignments and assignment failure diagnoses directly in the CS.
...
More specific diagnoses for assigning to read-only keypaths.
'computeAssignDestType' is dead code now.
ConstraintFix shouldRecordFix()
2018-08-24 20:39:03 -07:00
Pavel Yaskevich
294c05b41b
[Diagnostics] Split FailureDiagnostic::diagnose(bool asNote) into diagnoseAs{Error, Note}
2018-08-24 12:19:52 -07:00
Pavel Yaskevich
eefbb1547c
[Diagnostics] Implement diagnostic-as-note for requirement failures
2018-08-24 11:20:49 -07:00
Pavel Yaskevich
9f6891a4ed
[Diagnostics] Add asNote flag to FailureDiagnostic
...
The flag is used to indicate that caller is interested in
diagnostic to be a note instead of an error, it's useful
when trying to diagnose ambiguities.
2018-08-24 11:20:49 -07:00
Pavel Yaskevich
cc436e313a
[Diagnostics] Decouple FailureDiagnostic from Solution
2018-08-21 23:45:17 -07:00
Pavel Yaskevich
621204b7c6
Merge pull request #18870 from xedin/add-superclass-req-failure-diagnostic
...
[Diagnostics] Add `superclass` requirement fix/diagnostic
2018-08-21 09:16:41 -07:00
Pavel Yaskevich
16dfa6be72
[Diagnostics] Add superclass requirement fix/diagnostic
...
Extend new requirement failure diagnostics by adding "superclass"
generic requirement failures.
2018-08-21 00:39:21 -07:00
Greg Titus
e0a24ce93f
Merge pull request #18827 from gregomni/rvalue-as-lvalue
...
[ConstraintSystem] Move more lvalue diagnostics over to being handled via ConstraintFix
2018-08-20 20:25:51 -07:00
gregomni
834b550c7c
Instead of exposing getSolution, provide a restrictionForType API and use that.
2018-08-20 18:08:40 -07:00
gregomni
19fce5d36f
Move another chunk of lvalue diagnostics over to being handled via ConstraintFix.
2018-08-19 13:14:55 -07:00
Pavel Yaskevich
3cc613497c
[ConstraintSystem] Add same-type requirement fix/diagnostic
...
Extend new requirement failure diagnostics by adding "same-type"
generic requirement failures.
2018-08-18 13:05:32 -07:00
Greg Titus
32eacc5e80
Merge pull request #18608 from gregomni/rvalue-as-lvalue
...
[ConstraintSystem] New FailureDiagnostic for rvalues that should be lvalues
2018-08-18 11:43:23 -07:00
Pavel Yaskevich
6756c57f91
[Diagnostics] NFC: Move logic common to all requirement failures into RequirementFailure
...
This is going to make adding same-type and superclass requirement
failures might easier, because they only have to supply custom
diagnostic messages and substituted types.
2018-08-16 18:35:24 -07:00
gregomni
9e0dae513c
Start changing over rvalue-vs-lvalue errors to be done via constraint system fixes. For this first commit, just handling inout parameter problems.
2018-08-16 17:34:17 -07:00
Pavel Yaskevich
0f411b1102
[Diagnostics] Extract requirement declaration context retrieval into its own method
...
Change logic to traverse the chain of declaration contexts
starting for "affected" declaration's parent and check if the
requirement is satisfied by one of them, if so return it as
requirement's declaration context.
Extract this logic into a method on `RequirementFailure` to make
it accessible for other types of requirement failure diagnostics.
2018-08-16 01:25:51 -07:00
Pavel Yaskevich
e631a37ef6
[ConstraintSystem] Replace Fix with ConstraintFix throughout solver
2018-08-13 18:10:27 -07:00
Pavel Yaskevich
6d64b1c8a5
[Diagnostics] Some diagnostics possible only when locator is resolved down to expression
2018-08-09 22:23:31 -07:00
Pavel Yaskevich
e2cde5acc2
[Diagnostics] Port 'missing optional unwrap' diagnostic to new abstraction
2018-08-09 17:47:06 -07:00
Pavel Yaskevich
d72c204bad
[Diagnostics] Port member access on optional base diagnostic to new abstraction
2018-08-09 17:03:20 -07:00
Pavel Yaskevich
a564042fdc
[Diagnostics] Port missing explicit conversion to new abstraction
2018-08-09 17:01:54 -07:00
Pavel Yaskevich
9f9904b65d
[Diagnostics] Port missing & diagnostic to new abstraction
2018-08-09 13:57:57 -07:00
Pavel Yaskevich
284e109f1e
[Diagnostics] Try to compute precise diagnostic anchor
2018-08-09 13:53:33 -07:00
Pavel Yaskevich
f5aa0d9c75
[Diagnostics] Port missing force downcast diagnostic to new abstraction
2018-08-09 11:56:19 -07:00
Pavel Yaskevich
157dc719e0
[Diagnostics] Port implicitly escaping to type conversion diagnostics to new abstraction
2018-08-09 11:05:33 -07:00
Pavel Yaskevich
776485878f
[ConstraintSystem] NFC: Move new diagnostics into separate files - Diagnostics.(h|cpp)
2018-08-06 13:08:47 -07:00