Commit Graph

3981 Commits

Author SHA1 Message Date
swift-ci
d21e7e0aba Merge remote-tracking branch 'origin/main' into rebranch 2021-08-11 13:32:56 -07:00
Rintaro Ishizaki
ee918791a3 Merge pull request #38831 from rintaro/ide-srcinfo-diag
[CodeCompletion] Explain why results aren't recommended
2021-08-11 13:21:49 -07:00
swift-ci
df9aa08965 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-11 10:52:39 -07:00
Robert Widmann
d75b34be22 Merge pull request #38753 from CodaFi/modulo-modules
[NFC] Remove Unused Module Parameter to Conformance Lookup
2021-08-11 10:36:39 -07:00
Rintaro Ishizaki
df2b9715ba [CodeCompletion] Add "soft deprected" diagnostics for code completion
'available(..., deprecated: <version>)'. If the version is larger than the
current active version, the declaration is "soft deprecated". Emit a
relevant diagnostics for those items. If the version is equal to or
larger than '100000.0', it means the distant future without specifying
the version.

rdar://76122625
2021-08-10 17:11:14 -07:00
Rintaro Ishizaki
ed1db1bed2 [CodeCompletion] Explain why results aren't recommended
* Implement 'getDiagnosticSeverity()' and 'getDiagnosticMessage()' on
  'CodeCompletionResult'
* Differentiate 'RedundantImportIndirect' from 'RedundantImport'
* Make non-Sendable check respects '-warn-concurrency'

rdar://76129658
2021-08-10 17:11:14 -07:00
Rintaro Ishizaki
f8751d466e [CodeCompletion] Provide known module source file information
* 'CodeCompletionContext' now has 'requiresSourceFileInfo()' flag
* When 'true', 'SourceFiles' is populated.
* 'SourceFiles' is a list of pairs of a known module source
  file path and its up-to-date-ness
* Clients (i.e. 'CodeCompletionConsumer') can retrieve it from
  'CodeCompletionContext' in 'handleResults'
* Each completion item now has 'SourceFilePath' property
* C-APIs to get those informations
2021-08-10 17:11:14 -07:00
Ben Langmuir
d6eec880cb [completion] Update CodeCompletionConsumer::handleResults()
Receive 'CodeCompletionContext' so that consumers can get more
information from it.
2021-08-10 14:14:15 -07:00
swift-ci
57d8eac740 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-06 10:54:16 -07:00
Holly Borla
9f71ee1b0a Merge pull request #38766 from hborla/wrapped-argument-conversions
[Property Wrappers] Fix a bug where wrapped arguments were not properly coerced to the wrapper generator input type.
2021-08-06 13:36:37 -04:00
Arnold Schwaighofer
5a83172a55 Merge remote-tracking branch 'upstream/main' into rebranch 2021-08-05 12:04:56 -07:00
Holly Borla
28caecbc0f [Sema] Generalize PropertyWrapperInitializer to work with regular wrapped
properties.
2021-08-05 11:54:00 -04:00
Robert Widmann
808220510e [NFC] Remove Unused Module Parameter to Conformance Lookup
It's been quite a long time since this unused parameter was introduced.
The intent is to produce the module as a root for the search - that is,
computing the set of conformances visible from that module, not the set
of conformances inside of that module. Callers have since been providing
all manner of module-scoped contexts to it.

Let's just get rid of it. When we want to teach protocol conformance
lookup to do this, we can revert this commit as a starting point and try
again.
2021-08-04 14:43:31 -07:00
Ben Barham
f6a8dab93d [Refactoring] Use known alternative in async refactoring if one exists
Update the async refactorings to use the name from the async alternative
if one is known, rather than always assuming the name matches the
synchronous function.

Note that this could also be used to determine whether results remain
optional or not, but that has been left for a future patch.

Resolves rdar://80612521
2021-08-03 08:46:44 +10:00
Ben Barham
aeb36ab9e2 Merge pull request #38712 from apple/missing-roles
[IDE] Skip synthesized curry thunks and walk their unwrapped expression
2021-08-03 08:45:15 +10:00
Rintaro Ishizaki
0580357a05 Merge pull request #38044 from rintaro/ide-completion-rdar79092374
[CodeCompletion] Allow unresolved types in Callee analysis
2021-08-02 09:40:31 -07:00
Ben Barham
15c7ddd33f [IDE] Skip synthesized curry thunks and walk their unwrapped expression
SemaAnnotator was walking into an autoclosure and then manually running
`passReference` on the unwrapped expression without walking it. Since
its synthesized anyway, skip walking the autoclosure entirely and walk
the unwrapped expression instead.

Fix `swift::ide::isBeingCalled` to look through `IdentityExpr`s and
`swift::ide::getBase` also not unwrapping curry thunks.

Resolves rdar://81312849
2021-07-31 16:05:30 +10:00
swift-ci
a3f12be86b Merge remote-tracking branch 'origin/main' into rebranch 2021-07-29 09:40:49 -07:00
Hamish Knight
813a721760 Merge pull request #38674 from hamishknight/following-the-trail 2021-07-29 17:36:10 +01:00
swift-ci
2d0de01eac Merge remote-tracking branch 'origin/main' into rebranch 2021-07-28 20:53:04 -07:00
Ben Barham
e7e9b57051 Replace @completionHandlerAsync with @available(*, renamed:)
Instead of a new attribute `@completionHandlerAsync`, allow the use of
the existing `renamed` parameter of `@available` to specify the
asynchronous alternative of a synchronous function.

No errors will be output from invalid names as `@completionHandlerAsync`
had, but if a function is correctly matched then it will be used to
output warnings when using the synchronous function in an asynchronous
context (as before).

Resolves rdar://80612731
2021-07-29 09:14:44 +10:00
swift-ci
ac6d29b4cc Merge remote-tracking branch 'origin/main' into rebranch 2021-07-28 13:13:16 -07:00
Alex Hoppen
1286bbedf1 Merge pull request #38665 from ahoppen/pr/async-refactoring-parens-around-result
[Async Refactoring] Handle parenthesis around params that no longer need to be unwrapped after refactoring
2021-07-28 21:54:29 +02:00
Hamish Knight
06908adb08 [Async Refactoring] Handle multiple trailing closures
Update the trailing closure handling logic to
handle multiple trailing closures, and adjust the
refactoring output to surround the call in
parentheses rather than adding '.self'. This allows
the parser to deal with the multiple trailing
closures and also silences a warning that would
previously occur.

rdar://81230908
2021-07-28 20:50:40 +01:00
Alex Hoppen
3bea2b728c [Async Refactoring] Handle parenthesis around params that no longer need to be unwrapped after refactoring
Throw another `getSemanticsProvidingExpr` in the async refactoring code for better results.
2021-07-28 18:13:02 +02:00
swift-ci
f9fa632ccf Merge remote-tracking branch 'origin/main' into rebranch 2021-07-27 09:53:29 -07:00
Hamish Knight
470cb261ef [SyntaxModel] Correctly annotate unlabelled unary args
Previously we would only handle TupleExpr argument
list exprs. Update the logic to handle ParenExpr
argument lists too.

rdar://81154978
2021-07-27 11:38:07 +01:00
Hamish Knight
e4b7e3104a [SyntaxModel] Remove some dead code
This code doesn't quite do what it says it does,
and appears to be dead as we should never form an
argument list TupleExpr with an OptionalEvaluationExpr
parent. Given the test case that was added with it
still passes, let's remove it.
2021-07-27 11:38:06 +01:00
swift-ci
fe7fe50f7d Merge remote-tracking branch 'origin/main' into rebranch 2021-07-26 13:54:13 -07:00
Hamish Knight
40e20a270d Don't apply "Convert to Trailing Closure" to call with multiple trailing closures
Previously we'd perform an invalid transform or hit
an assertion failure. For now, disallow the transform
for a call that already uses trailing closure syntax.

rdar://81106400
2021-07-26 17:15:22 +01:00
swift-ci
fd87ebc401 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-23 07:13:34 -07:00
Robert Widmann
03d8690ff6 Merge pull request #38403 from CodaFi/sigarillo
Lift Requirement and Parameter Accessors up to GenericSignature
2021-07-23 07:08:17 -07:00
swift-ci
b35453f787 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-23 01:53:40 -07:00
Hamish Knight
52483887ea Merge pull request #38583 from hamishknight/errors-as-warnings 2021-07-23 09:48:31 +01:00
Robert Widmann
d86551de67 Lift Requirement and Parameter Accessors up to GenericSignature
Start treating the null {Can}GenericSignature as a regular signature
with no requirements and no parameters. This not only makes for a much
safer abstraction, but allows us to simplify a lot of the clients of
GenericSignature that would previously have to check for null before
using the abstraction.
2021-07-22 23:27:05 -07:00
swift-ci
cdf7a9314f Merge remote-tracking branch 'origin/main' into rebranch 2021-07-22 21:54:12 -07:00
Hamish Knight
1ebb1fd2f5 [Async Refactoring] Add parens around custom error cast
When passing a forwarded error to a CustomError?
completion handler parameter, wrap the cast in a
set of parentheses to silence a warning in the
refactored code.

rdar://80409905
2021-07-22 23:20:24 +01:00
Rintaro Ishizaki
6c4eaa121d [CodeCompletion] Handle "unsafe" global actor isolation
For 'unsafe' global actor isolation, implicit "async" happens only if
* The context adopted concurrency feature
* Not '-warn-concurrency' specified

rdar://80907499
2021-07-22 15:17:20 -07:00
swift-ci
002ef14101 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-21 09:34:02 -07:00
Hamish Knight
9c61dbb692 Merge pull request #38531 from hamishknight/out-of-sync 2021-07-21 17:17:21 +01:00
Hamish Knight
007b91cf7b [Async Refactoring] Update to use Task's init
Use the Task initializer instead of the top-level
`async` function to match the latest Concurrency
API.

rdar:80888385
2021-07-21 11:40:35 +01:00
swift-ci
87767e4a80 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-20 14:34:38 -07:00
Hamish Knight
ab594ddc6f Merge pull request #38503 from hamishknight/another-one-bites-the-subst 2021-07-20 22:23:24 +01:00
swift-ci
94817d06b4 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-20 09:13:59 -07:00
Rintaro Ishizaki
a14ba63d6a Merge pull request #38487 from rintaro/ide-completion-callargchunk 2021-07-20 09:11:52 -07:00
Hamish Knight
d4c25f55c2 [AST] Reject GenericFunctionType in TypeBase::getTypeOfMember
Remove the default argument for the `memberType`
parameter and enforce that GenericFunctionType is
not passed. Also add a defaulted overload for the
property case, as they should never have a
GenericFunctionType interface type.
2021-07-20 14:11:31 +01:00
Hamish Knight
7302792506 [IDE] Use method result type for getTypeOfMember call
Previously we were defaulting to the method's
interface type, which could lead to calling `subst`
with a GenericFunctionType. Instead, pass the
result type only, as that's all we want anyway.

rdar://77259607
2021-07-20 14:11:30 +01:00
Rintaro Ishizaki
5559d9406f [CodeCompletion] NFC: rename CallParameter* to CallArgument*
Since these chunks are for call sites, the correct term is "argument".
2021-07-19 16:30:12 -07:00
swift-ci
bfeb8e4de7 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-19 10:34:31 -07:00
Hamish Knight
63c6f987de Merge pull request #38447 from hamishknight/fewer-substitutions-for-you 2021-07-19 18:14:09 +01:00