Commit Graph

62055 Commits

Author SHA1 Message Date
Slava Pestov
76a81efac9 ASTDemangler: Fix reconstruction of opaque result type defined in a constrained extension
The mangling includes all generic parameters, even non-canonical ones.

Fixes <rdar://problem/67949286>.
2020-08-30 01:39:50 -04:00
Pavel Yaskevich
8573c99117 Merge pull request #33690 from xedin/csbindings-protocol-propagation
[ConstraintSystem] NFC: Clarify why upward propagation of literal conforma…
2020-08-29 01:06:07 -07:00
Nathan Hawes
3e8278ae71 Merge pull request #33676 from nathawes/parser-completion-fixes
[Parse][IDE] Various parser fixes for code completion
2020-08-28 22:11:31 -07:00
Doug Gregor
10fa19b2b5 Merge pull request #33674 from DougGregor/concurrency-objc-import-async
[Concurrency] Import Objective-C methods with completion handlers as async
2020-08-28 19:48:02 -07:00
Michael Gottesman
8c1be69b53 Merge pull request #33677 from gottesmm/pr-0c62e0beda3a13e79c75b247649fefab99d7dc7b
[ownership] Move SemanticARCOpts into a separate folder in preparation for splitting into multiple small pseudo-passes.
2020-08-28 18:40:45 -07:00
Suyash Srijan
172c4be02d [Sema] Diagnose use of ambiguous property wrappers (#33688) 2020-08-29 02:38:42 +01:00
Anthony Latsis
5525a7853a Merge pull request #33663 from AnthonyLatsis/unbound-closure-retty
CSGen: Infer generic arguments for explicit closure result types
2020-08-29 03:46:30 +03:00
Pavel Yaskevich
ebc03a1805 [CSBindings] NFC: Remove dead condition leftover from Swift version 3 support 2020-08-28 17:39:21 -07:00
Pavel Yaskevich
c03d76291c [ConstraintSystem] NFC: Clarify why upward propagation of literal conformances is ncessary at the moment
This is NFC because only literal protocols are tracked at the moment.

Forward propagate (subtype -> supertype) only literal conformance
requirements since that helps solver to infer more types at
parameter positions.

```swift
func foo<T: ExpressibleByStringLiteral>(_: String, _: T) -> T {
  fatalError()
}

func bar(_: Any?) {}

func test() {
  bar(foo("", ""))
}
```

If one of the literal arguments doesn't propagate its
`ExpressibleByStringLiteral` conformance, we'd end up picking
`T` with only one type `Any?` which is incorrect.

This is not going to be necessary once bindings are filtered based
of requirements placed on a type variable.
2020-08-28 17:30:19 -07:00
Nathan Hawes
89803560f9 [Parse] Perform the single expression function body transform for delayed parsing as well
We were previously only doing it when parsing up front.
2020-08-28 17:09:37 -07:00
Nathan Hawes
3e0500d73c [Parse][IDE] Don't drop default argument init exprs containing code completion exprs and type check them for code completion.
Fixes up some tests marked as non-ideal to give the ideal result now too.
2020-08-28 17:09:37 -07:00
Nathan Hawes
00994f1147 [Parse] Stop early exiting when parsing catch statements and ObjCSelector expressions that contain code completions. 2020-08-28 17:09:37 -07:00
Nathan Hawes
c4f05052da [Parse] Don't drop throws containing a code completion expression. 2020-08-28 17:09:37 -07:00
Mike Ash
50ea66d1d9 Merge pull request #33585 from mikeash/type-lookup-error-reporting
Add error reporting when looking up types by demangled name.
2020-08-28 17:42:47 -04:00
Varun Gandhi
8df83150fb Merge pull request #33541 from varungandhi-apple/vg-clang-types-in-sil-setup
Setup code for Clang types in SIL.
2020-08-28 14:34:27 -07:00
Robert Widmann
592d427876 Merge pull request #33668 from CodaFi/field-day
[SR-13461] Relax An Assert
2020-08-28 14:07:23 -07:00
Robert Widmann
7c8041ae9a Merge pull request #33672 from CodaFi/ceci-nest-pas-une-pipeline
[NFC] Clean Up FrontendTool
2020-08-28 14:07:03 -07:00
Doug Gregor
6ad2757bef [Concurrency] Use completion/completionHandler parameter names for async import
Extend the check for completion handler parameters to also consider the
name of the parameter (not its argument label). If it's `completion` or
`completionHandler`, we have a completion handler. This extends our
API coverage for importing Objective-C methods with completion
handlers as 'async'.
2020-08-28 13:58:02 -07:00
Mike Ash
fd6922f92d Add error reporting when looking up types by demangled name. 2020-08-28 14:43:51 -04:00
Rintaro Ishizaki
c48a676a1c Merge pull request #31679 from Jumhyn/implicit-member-chains-different-types
[SE-0287] [Sema] Implementation for implicit member chains
2020-08-28 10:47:53 -07:00
Pavel Yaskevich
a6c3e6f543 Merge pull request #33658 from xedin/introduce-hole-type
[ConstraintSystem] Introduce a new type to represent a type hole
2020-08-28 10:40:15 -07:00
Artem Chikin
02513b1c11 Merge pull request #33671 from artemcm/BatchScannerTargetExtract
[Dependency Scanner] Batch scanner: extract target triple from the PCMArgs for the batch invocation.
2020-08-28 10:16:14 -07:00
Joe Groff
f588f2f478 Merge pull request #33650 from jckarter/global_init_mangling
Remove hardcoded symbol name parsing from SILOptimizer passes
2020-08-28 08:34:35 -07:00
Michael Gottesman
1132cda811 [ownership] Move SemanticARCOpts into a separate folder in preparation for splitting into multiple small pseudo-passes.
SemanticARCOpts keeps on growing with various optimizations attached to a single
"optimization" manager. Move it to its own folder in prepation for splitting it
into multiple different optimizations and utility files.
2020-08-27 23:58:14 -07:00
Doug Gregor
1e5d30f5ca [Concurrency] Import Objective-C methods with completion handlers as async
When a given Objective-C method has a completion handler parameter
with an appropriate signature, import that Objective-C method as
async. For example, consider the following CloudKit API:

    - (void)fetchShareParticipantWithUserRecordID:(CKRecordID
*)userRecordID
            completionHandler:(void (^)(CKShareParticipant * _Nullable shareParticipant, NSError * _Nullable error))completionHandler;

With the experimental concurrency model, this would import as:

    func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID) async throws -> CKShare.Participant?

The compiler will be responsible for turning the caller's continuation
into a block to pass along to the completion handler. When the error
parameter of the completion handler is non-null, the async call
will result in that error being thrown. Otherwise, the other arguments
passed to that completion handler will be returned as the result of
the async call.

async versions of methods are imported alongside their
completion-handler versions, to maintain source compatibility with
existing code that provides a completion handler.

Note that this only covers the Clang importer portion of this task.
2020-08-27 21:30:13 -07:00
Rintaro Ishizaki
f3cebd2f00 Merge pull request #33669 from rintaro/ide-completion-rdar67102794
[CodeCompletion] Ensure all ExtensionDecl's extended types are computed
2020-08-27 21:23:26 -07:00
Meghana Gupta
b1db77adff Fix ConnectionGraph verification for calls to no return functions. (#33655)
Functions that do not have a return, and instead end with 'unreachable'
due to NoReturnFolding will not have a ReturnNode in the connection
graph.

A caller calling a no return function then may not have a CGNode
corresponding to the call's result.

Fix the ConnectionGraph's verifier so we don't assert in such cases.
2020-08-27 20:42:23 -07:00
Luciano Almeida
82fc202d52 Merge pull request #33603 from LucianoPAlmeida/SR-13079-improve-kp-optional-root-diagnostics
[Sema] Improve diagnostics for key path root type inferred as option accessing wrapped member
2020-08-27 23:54:09 -03:00
Artem Chikin
5afbddb42b [Dependency Scanner] Ensure that Clang dependency scanner instances inherit the creating invocation's extra clang args.
This ensures that when the dependency scanner is invoked with additional clang (`-Xcc`) options, the Clang scanner is correctly configured using these options.
2020-08-27 19:21:53 -07:00
Artem Chikin
12dd83db4f Merge pull request #33670 from artemcm/ClangScannerPathPrefixes
[Dependency Scanner] Prefix Clang dependency scanner search path arguments with `-Xcc`
2020-08-27 17:54:29 -07:00
Doug Gregor
16876fbf66 [Clang importer] Drop unused parameter from getParamOptionality().
This operation is not actually dependent on the version.
2020-08-27 17:06:42 -07:00
Rintaro Ishizaki
e013ebd388 [CodeCompletion] Ensure all ExtensionDecl's extended nominal are computed
Fixes an assertion failure in ASTScope lookup

rdar://problem/67102794
2020-08-27 16:17:43 -07:00
Robert Widmann
4c56c95674 Define doesActionRequireInputs 2020-08-27 16:17:20 -07:00
Robert Widmann
fe7444ffa3 Add doesActionRequireSwiftStandardLibrary 2020-08-27 16:17:20 -07:00
Robert Widmann
4c7ccf5abe [NFC] Clean Up FrontendTool
Try to impose a simple structure that splits performing actions from the
pre and post-pipeline conditions. Wherever actions would take more than
a simple return, split them into functions. Refine functions that
perform effects to return status codes when they fail. Finally,
delineate functions that need semantic analysis from those that do not.

Overall this should be NFC.
2020-08-27 16:15:44 -07:00
Luciano Almeida
4b921c3487 [Sema] Improve diagnostics for key path root type inferred as option accessing wrapped member 2020-08-27 20:07:18 -03:00
Joe Groff
0bef4a661b Give global once symbols stabler manglings.
This allows symbol ordering and other analyses to be more robust with regards to these symbols.
2020-08-27 16:00:20 -07:00
Pavel Yaskevich
4847ec9a6b [AST/TypeChecker] Add more asserts to make sure types don't get into AST 2020-08-27 13:18:45 -07:00
Artem Chikin
863bca87e8 [Dependency Scanner] Prefix Clang dependency scanner search path arguments with -Xcc
Experimentally, this seems to be required for these paths to actually be picked up by the underlying scanner.
2020-08-27 13:17:12 -07:00
Varun Gandhi
fdbcd1236f [NFC] Bridge based on SILFunctionLanguage instead of Representation. 2020-08-27 13:14:05 -07:00
Varun Gandhi
eeec16f143 [NFC] Remove redundant ExtInfo parameter for getBridgedFunctionType.
At all call-sites, the extInfo passed as the third argument is computed directly
from the second argument, so we compute it directly in getBridgedFunctionType.
2020-08-27 13:14:05 -07:00
Varun Gandhi
eead4ae8f0 [NFC] Remove unused function parameter. 2020-08-27 13:14:05 -07:00
Varun Gandhi
8da4d53d2c [NFC] Use ClangTypeInfo's implicit null state instead of an extra Optional. 2020-08-27 13:14:05 -07:00
Varun Gandhi
eaac23fdd4 [NFC] Remove ASTExtInfo::assertIsFunctionType in favor of checkInvariants.
Invariants should be checked only when calling build(), not when the builder
itself is created.
2020-08-27 13:14:05 -07:00
Varun Gandhi
1807412e85 [Serialization] Allow different Clang types in deserialization.
We could've stored a function pointer or a block pointer or a function reference.
2020-08-27 13:14:05 -07:00
Varun Gandhi
c890cdd1a3 [AST] Add functionality for computing Clang types for SIL functions. 2020-08-27 13:14:05 -07:00
Robert Widmann
84c5065547 [SR-13461] Relax An Assert
This assert doesn't consider reference storage types in its predicate.
Look through them since they're not relevant to the type consistency
check it's trying to pick out.
2020-08-27 12:51:04 -07:00
Anthony Latsis
61d86d5fd2 [NFC] CSGen: Clean up some flow in inferClosureType 2020-08-27 22:25:07 +03:00
Anthony Latsis
80560dab25 CSGen: Infer generic arguments in explicit closure result types 2020-08-27 22:17:58 +03:00
Dan Zheng
83b50cd8e3 [AutoDiff] Add missing withoutDerivative(at:) fix-its. (#33660)
Add `withoutDerivative(at:)` fix-its for errors regarding non-differentiable
arguments and results.
2020-08-27 11:53:33 -07:00