Robert Widmann
abc6db13b1
Provide AST Context Getters To Protocol Inference
2019-10-30 12:55:42 -07:00
Robert Widmann
118f68b1be
Make getProtocol and getLiteralProtocol static utilities
2019-10-30 12:55:42 -07:00
Anthony Latsis
6325915b4b
NFC: Solidify and tidy up the BraceStmt interface
2019-10-30 16:43:59 +03:00
Robert Widmann
b849e51768
Use operator bool to claw back some readability
2019-10-29 16:56:21 -07:00
Robert Widmann
3e1a61f425
[NFC] Fold The Tri-State In Optional<ProtocolConformanceRef>
...
ProtocolConformanceRef already has an invalid state. Drop all of the
uses of Optional<ProtocolConformanceRef> and just use
ProtocolConformanceRef::forInvalid() to represent it. Mechanically
translate all of the callers and callsites to use this new
representation.
2019-10-29 16:55:56 -07:00
Pavel Yaskevich
58329e0c27
Revert "[Diagnostics][Qol] SR-11295 Emit diagnostics for same type coercion. "
2019-10-25 01:05:07 -07:00
Luciano Almeida
5d1eeacbe4
Resolving conflicts
2019-10-23 07:25:55 -03:00
Pavel Yaskevich
d5b232c26e
Merge pull request #27834 from xedin/for-in-diag
...
[TypeChecker] Produce a tailored diagnostic for `for-in` sequence fai…
2019-10-23 00:32:35 -07:00
Pavel Yaskevich
fb6ce64628
Merge pull request #27842 from xedin/if-ternary-diags
...
[Diagnostics] Improve if/ternary condition expression diagnostics
2019-10-23 00:32:06 -07:00
Pavel Yaskevich
74a7f3d8d0
[TypeChecker] Produce a tailored diagnostic for for-in sequence failures
...
`for-in` "sequence" expression is required to conform to `Sequence`.
2019-10-22 16:57:28 -07:00
Pavel Yaskevich
c4fee1d0c9
[ConstraintSystem] Use new condition element in constraint generation/diagnostics
2019-10-22 15:01:49 -07:00
Hamish Knight
be23ecc878
These functions don't need a TypeChecker
2019-10-22 09:23:33 -07:00
Luciano Almeida
4385dd854f
Creating UnnecessaryCoercion warning fix
2019-10-21 23:03:12 -03:00
Anthony Latsis
d64d45d3d6
@lvalue exposure fixes & prevention
2019-10-22 04:30:40 +03:00
Holly Borla
e5c99cace6
Merge pull request #27769 from hborla/anyobject-conformance-failure
...
[ConstraintSystem] Diagnose missing AnyObject conformance using the MissingConformance constraint fix.
2019-10-18 22:10:21 -04:00
Holly Borla
ea7c13e506
[Diagnostics] For now, don't diagnose layout requirement failures
...
in MissingConformanceFailure::diagnoseTypeCannotConform.
2019-10-18 14:00:18 -07:00
Holly Borla
0d95a84e91
[Diagnostics] Improve the error message for when a type fails to satisfy
...
`AnyObject` layout requirement.
2019-10-18 11:27:21 -07:00
Pavel Yaskevich
8d05192204
Merge pull request #27728 from xedin/port-extraneous-args
...
[Diagnostics] Diagnose extraneous argument(s) via fixes
2019-10-18 10:42:56 -07:00
Holly Borla
ec864fcd9c
[ConstraintFix] Don't pass along the RequirementKind to the MissingConformance
...
constraint fix. Instead, get the kind from the locator.
2019-10-18 09:03:06 -07:00
Pavel Yaskevich
14d9011c2b
Merge pull request #27759 from xedin/port-keypath-diags
...
[Diagnostics] Port more key path related failures to new framework
2019-10-18 01:02:43 -07:00
Holly Borla
f998349815
[Diagnostics] Add a tailored note for when the Wrapped type of an
...
optional satisfies a failed requirement.
2019-10-17 19:59:07 -07:00
Pavel Yaskevich
0d07cd87ac
[ConstraintSystem] Detect and diagnose contextual mismatches in key path components
2019-10-17 13:52:00 -07:00
Robert Widmann
56b6e53dae
Remove raw references to PatternBindingEntry APIs
...
Switch most callers to explicit indices. The exceptions lie in things that needs to manipulate the parsed output directly including the Parser and components of the ASTScope. These are included as friend class exceptions.
2019-10-17 13:31:14 -07:00
Holly Borla
ef0ecc41e5
[ConstraintSystem] Diagnose missing AnyObject conformance using
...
the MissingConformance constraint fix.
2019-10-16 20:38:00 -07:00
Luciano Almeida
d022c98e68
Returning false for unhandled expr in GenericArgumentsMismatchFailure
2019-10-16 22:55:04 -03:00
Pavel Yaskevich
d69a1a5eee
[CSDiagnostics] Attach extra argument ambiguity note to the overload choice
2019-10-16 10:19:26 -07:00
Pavel Yaskevich
b214b8a2bf
[Diagnostics] Introdduce multiple extraneous arguments diagnostic
2019-10-16 10:19:26 -07:00
Pavel Yaskevich
02688a9091
[Diagnostics] Tailored diagnostic for missing arguments in contextual conversion
2019-10-16 10:19:26 -07:00
Pavel Yaskevich
43f95a3e25
[Diagnostics] NFC: Adopt new getArgumentListExprFor API
2019-10-16 10:19:26 -07:00
Pavel Yaskevich
40ac874616
[Diagnostics] Diagnose extraneous arguments in a nullary call
2019-10-16 10:19:26 -07:00
Pavel Yaskevich
c97603f5d4
[CSDiagnostics] Diagnose extraneous arguments
2019-10-16 10:19:25 -07:00
Luciano Almeida
73dcc4b5e8
Merge branch 'master' of https://github.com/apple/swift into force-downcast-fix-explicit-coercion
2019-10-15 19:18:46 -03:00
Pavel Yaskevich
d90117bb8a
[Diagnostics] Remove argument handling from conformance failures
...
Argument-to-Parameter mismatch handles conformance failures
related to arguments, so the logic in `MissingConformanceFailure`
which wasn't entirely correct is now completely obsolete.
Resolves: rdar://problem/56234611
2019-10-14 00:34:37 -07:00
Luciano Almeida
30ffe13cba
Merge branch 'master' of https://github.com/apple/swift into force-downcast-fix-explicit-coercion
2019-10-13 11:09:37 -03:00
Luciano Almeida
171d6ec87d
Adjusting tests under test/Constraints/bridging-nsnumber-and-nsvalue.swift.gyb
2019-10-13 00:42:22 -03:00
Luciano Almeida
d896968d2c
clang-format
2019-10-12 22:39:12 -03:00
Luciano Almeida
05cea3a7b7
Fix issue with dictionary_downcast tests
2019-10-12 16:49:36 -03:00
Luciano Almeida
f39ff88113
Initial implementation of moving the checks
2019-10-12 15:22:16 -03:00
Luciano Almeida
21c179d46f
Removing fixed CoerceToCheckedCast constraint and letting repairFailures handle the diagnostics
2019-10-12 11:38:59 -03:00
Robert Widmann
7770564f1a
Merge pull request #27624 from CodaFi/in-locale-parentis
...
Downgrade The TypeLoc in VarDecl to a TypeRepr
2019-10-11 14:53:10 -07:00
Pavel Yaskevich
8e16aa4b8d
[Diagnostics] Extend argument-to-parameter mismatch note to cover inout parameters
2019-10-11 12:38:11 -07:00
Robert Widmann
2516089cb6
Clean up the pseudo-clone-constructor for ParamDecl
2019-10-11 11:51:50 -07:00
Robert Widmann
060cbb293f
[NFC] Downgrade The TypeLoc in VarDecl to a TypeRepr
...
TypeCheckPattern used to splat the interface type into this, and
different parts of the compiler would check one or the other. There is
now one source of truth: The interface type. The type repr is now just
a signal that the user has written an explicit type annotation on
a parameter. For variables, we will eventually be able to just grab
this information from the parent pattern.
2019-10-11 11:15:51 -07:00
Pavel Yaskevich
773ac24bc9
[ConstraintSystem] Detect and diagnose type mismatch failures of inout parameters
...
Currently absence of `subtyping` is the only problem detected and diagnosed specifically
for `inout` parameters, but there could be type mismatches in `inout` positions as well
and we can use `argument-to-parameter mismatch fix to detect and diagnose them.
2019-10-10 17:06:13 -07:00
Pavel Yaskevich
51476cde58
[Diagnostics] Clarify tuple splat message when single parameter is generic parameter
...
Since it's hard to say whether tuple use is really intended, let's
add `did you mean to pass a tuple?` note to the error message.
2019-10-09 10:58:31 -07:00
Pavel Yaskevich
c62c2890f8
[Diagnostics] Fix fix-it location for labeled tuple splat
...
In situations like this:
```swift
func foo(x: (Int, Int) {}
foo(x: 0, 0)
```
Left paren to form a missing tuple should be placed after
the label because belongs to the parameter and not the tuple.
2019-10-08 18:12:17 -07:00
Luciano Almeida
12f98d7922
Merge branch 'master' into force-downcast-fix-explicit-coercion
2019-10-06 13:35:44 -03:00
Hamish Knight
e2096ae34d
[CSDiagnostics] Tweak candidate note text for arg mismatch
...
Number the parameters starting at 1 in order to
match other diagnostics such as
diag::missing_argument_positional, and change the
text to make it explicit that we're referring to
the parameter position (rather than argument
position).
2019-10-03 15:26:31 -07:00
Hamish Knight
f03d210be9
Make getFunctionArgApplyInfo more lenient with CSDiag
2019-10-03 15:26:31 -07:00
Hamish Knight
ec45b24b63
Use hasAppliedSelf in getFunctionArgApplyInfo
...
`callee->hasCurriedSelf()` isn't the correct check
here when we have an argument mismatch for the
self parameter in a curried application.
2019-10-03 15:26:31 -07:00