Commit Graph

39091 Commits

Author SHA1 Message Date
Rintaro Ishizaki
496c303ab5 Merge pull request #30865 from rintaro/sourcekit-completion-rdar61367416
[SourceKit] Don't use diagnostics to indicate fast-completion
2020-04-07 17:58:19 -07:00
Holly Borla
b2e6048f55 Merge pull request #30844 from hborla/diagnose-for-ambiguity
[Diagnostics] In DefineMemberBasedOnUse::diagnoseForAmbiguity, use the base type from each solution
2020-04-07 17:52:20 -07:00
Andrew Trick
69a22f6d95 Simplify metatype instructions.
Tuple, Struct, and Enum MetatypesTypes have a single value. In this
case, replace metatype instructions with arguments of the same
MetatypeType to enable downstream CSE and SILCombines.
2020-04-07 17:24:00 -07:00
marcrasi
eefe9a083c Merge pull request #30851 from apple/derivative-attr-serialization
[AutoDiff] SR-12526: cross-module @derivative deserialization
2020-04-07 17:23:47 -07:00
Suyash Srijan
8f44a0bd66 [TypeChecker] Diagnose key paths with contextual type but no leading dot
If a Swift key path has root type inferred but does not have a leading dot,
then diagnose it, because it's not valid.

For example:

```swift
struct Foo {
  let property: [Int] = []
  let kp: KeyPath<Foo, Int> = \property.count // error
}
```

Resolves SR-12290
Resolves rdar://problem/59874355
2020-04-07 16:59:23 -07:00
Rintaro Ishizaki
c762db1a9e Merge pull request #30858 from rintaro/sourcekit-annotateddescription-fixtest-windows
[CodeCompletion] Use --strip-trailing-cr for diff test
2020-04-07 16:43:48 -07:00
Rintaro Ishizaki
4870d1c017 [SourceKit] Don't use diagnostics to indicate fast-completion
Add 'key.reusingastcontext: 1' to the response instead.
Using diagnostics can be a noise to indexing log clients.

rdar://problem/61367416
2020-04-07 16:26:00 -07:00
Ashley Garland
d6e49a98db [SymbolGraph] Put extending declarations in rootmost module
When extending another module's type in your module, serialize declarations in
the extension into the other module's "extension" symbol graph file, including
relationships. This mechanic should continue up to the rootmost module. For
example:

A.AStruct <- B.BStruct < C.CStruct

Both BStruct and CStruct should go in `@A` symbol graph files because AStruct
owns BStruct and by extension owns CStruct. This is reflected in
documentation curation in some form already.

rdar://60796811
2020-04-07 15:41:59 -07:00
Marc Rasi
7abf8ae305 actually set the lazy resolver 2020-04-07 15:05:27 -07:00
Ravi Kandhadai
4264b39b23 Merge pull request #26969 from ravikandhadai/oslog-user-model
[Sema Diagnostics] Add Miscellaneous Sema diagnostics to enforce that the new os log APIs and atomics are passed constants for certain arguments
2020-04-07 13:23:10 -07:00
Rintaro Ishizaki
837fa0d250 [CodeCompletion] Use --strip-trailing-cr for diff test 2020-04-07 13:15:41 -07:00
Doug Gregor
78880ffc1a Merge pull request #27776 from owenv/catch_revamp_take_4
[SE-0276] Support multiple patterns in catch clauses
2020-04-07 12:31:33 -07:00
Rintaro Ishizaki
31e7873704 Merge pull request #30767 from rintaro/sourcekit-completion-annotateddesc-rdar60801189
[SourceKit/CodeCompletion] Add an option to emit annotated description
2020-04-07 11:33:21 -07:00
Slava Pestov
2af7d8a1f0 Merge pull request #30847 from slavapestov/opaque-type-lowering-access-level-fix
AST: Fix accessibility checking in opaque type archetype substitution logic
2020-04-07 14:08:11 -04:00
Pavel Yaskevich
bd44fb3ef3 Merge pull request #30838 from xedin/rdar-61347993
[ConstraintSystem] Don't bind result type of an empty closure too early
2020-04-07 10:40:12 -07:00
Marc Rasi
2d1436e8d2 fix SR-12526 test 2020-04-07 10:26:57 -07:00
Slava Pestov
dbaa61953e AST: Fix accessibility checking in opaque type archetype substitution logic
We were failing to replace opaque types with their underlying type
upon encountering an internal type from the current module. This
could happen when the internal type appeared in generic substitutions,
for example when calling a protocol extension method.

Fixes <rdar://problem/60951353>.
2020-04-07 12:13:38 -04:00
Arnold Schwaighofer
66ea6e6f38 Merge pull request #30839 from aschwaighofer/irgen_fix_partial_apply_on_stack_indirect
IRGen: Fix capture of indirect values in ``[onstack]`` closures
2020-04-07 06:09:00 -07:00
Rintaro Ishizaki
339ebbfa89 [CodeCompletion] Update annotation description test case to test cache 2020-04-07 00:50:43 -07:00
Rintaro Ishizaki
28de43b7ca [CodeCompletion] Trim whitespaces around the content 2020-04-07 00:50:43 -07:00
Rintaro Ishizaki
c633da047d [CodeCompletion] Add IDE test case for annotated description 2020-04-07 00:50:43 -07:00
Rintaro Ishizaki
773a464e83 [CodeCompletion] Add an option to emit annotated description 2020-04-07 00:46:14 -07:00
Dario Rexin
999b93bfdb Merge pull request #30815 from ktoso/wip-mangledTypeName
Improve usability of _mangledTypeName with Any.Type arguments
2020-04-06 20:49:13 -07:00
Slava Pestov
05352ceaab Merge pull request #30840 from slavapestov/dwarf-mangler-substitutions-fix
ASTMangler: Fix substitution round-tripping in the DWARF mangler
2020-04-06 23:37:09 -04:00
Ravi Kandhadai
b57a1d7c0e [Sema] Add miscellaneous sema diagnostics to check that the new os log
APIs and atomic operations are passed compile-time constants for
certain arguments.
2020-04-06 18:41:13 -07:00
Cyndy Ishida
9e916abf41 Merge pull request #30831 from cyndyishida/tbdv4-switch
[TBDGen] update tbd version
2020-04-06 18:38:25 -07:00
Holly Borla
6375481ea4 [Diagnostics] In DefineMemberBasedOnUse::diagnoseForAmbiguity, use
the base type from each solution instead of only the base type from
the first solution.
2020-04-06 17:35:31 -07:00
Doug Gregor
7a2c28db1a [TBD] Update test to account for iOS device vs. iOS simulator.
The test was only checking iOS, and assuming that simulator targets
would behave the same way. Make the test amenable to both iOS and
iOS simulator.
2020-04-06 16:52:56 -07:00
Doug Gregor
6784930f3b [lit] Use simulator triples consistently. 2020-04-06 16:52:56 -07:00
Doug Gregor
5bbc43c4d2 [CMake] Add -simulator to simulator target triples.
The build systems that drive Swift compilation have been using the
"simulator" environment as part of the increasingly inaccurately
named "target triple" to specify simulator targets for several
years... except our own hand-rolled build system. Identify
simulator targets and append "-simulator" to their target
triples.
2020-04-06 16:52:56 -07:00
Dan Zheng
fccfa29240 [AutoDiff upstream] Update LoadableByAddress. (#30825)
Update LoadableByAddress to handle AutoDiff-related instructions:
- `differentiable_function`
- `differentiable_function_extract`
- `linear_function`
- `linear_function_extract`
- `differentiability_witness_function`
2020-04-06 16:47:38 -07:00
Nathan Hawes
3ebb81e38f Merge pull request #30841 from nathawes/fix-cross-import-doc-support-test
[test] Fix DocSupport test that should have passed -enable-cross-import-overlays
2020-04-06 16:28:29 -07:00
Pavel Yaskevich
04e2795a03 [ConstraintSystem] Don't bind result type of an empty closure too early
Instead of setting empty closure (`{}`) result type to be `Void`
while generating constraints, let's allocate a new type variable
instead and let it be bound to `Void` once the body is opened.

This way we can support an interaction with function builders which
would return a type different from `Void` even when applied to empty closure.

Resolves: rdar://problem/61347993
2020-04-06 15:55:55 -07:00
Slava Pestov
3e4b95f234 ASTMangler: Fix substitution round-tripping in the DWARF mangler
When mangling sugared types for DWARF debug info, we would
occassionally mix generic parameter types from different
generic environments. Since the mangling for a generic
parameter type only recorded the depth and the index, even
for distinct sugared forms, the remangler would produce a
more 'compact' mangling, by folding together generic parameters
that have the same depth/index, but distinct sugarings in the
AST.

Prevent this from happening by desugaring DWARF types the
correct amount, substituting away generic parameters while
preserving everything else.

Also, re-enable the round-trip verification with the remangler.

Fixes <rdar://problem/59496022>, <https://bugs.swift.org/browse/SR-12204>.
2020-04-06 18:19:57 -04:00
Stephen Canon
248c554524 Add Float16 to stdlib (#30130)
Add Float16 (IEEE 754 binary16) to the standard library, plus assorted runtime support operations.

Swift Evolution thread: https://forums.swift.org/t/se-0277-float16/33546
2020-04-06 17:57:44 -04:00
Nathan Hawes
b2fe997e7b Merge pull request #30836 from nathawes/doc-info-where-from-context
[SourceKit/DocSupport] List generic requirements from contextual where clauses in doc info request
2020-04-06 14:04:51 -07:00
Robert Widmann
c71ac7ab8e Merge pull request #30834 from CodaFi/gatekeeper
Fix the gates on a test that needs statistics
2020-04-06 13:59:58 -07:00
Nathan Hawes
6e3f512fd1 [test] Fix DocSupport test that should have passed -enable-cross-import-overlays
Resolves rdar://problem/61346236
2020-04-06 13:57:36 -07:00
Arnold Schwaighofer
5ab6df8f94 IRGen: Fix capture of indirect values in `[onstack]` closures
A [onstack] closure does not take ownership of its arguments. It is
therefore not correct to use an initWithTake copy of indirect arguments.

Instead we just capture the address of the indirect argument.

rdar://61261982
2020-04-06 13:23:34 -07:00
Hamish Knight
d6a6df2cf6 [CS] Fix invalid key path crasher (#30832)
[CS] Fix invalid key path crasher
2020-04-06 12:14:38 -07:00
Pavel Yaskevich
cbf3cab966 Merge pull request #30746 from ismetanin/fix-it-for-removing-escaping-from-optional-closure-parameter
Add new error diagnostic for escaping optional closures
2020-04-06 12:03:42 -07:00
Nathan Hawes
af0509e106 [SourceKit/DocSupport] List generic requirements from contextual where clauses in doc info request
We previously didn't report the requirements in the where clause of 'boxes'
below because it didn't have generic parameters of its own:

public struct Box<Wrapped> {
    public func boxes() -> [Box<Wrapped.Element>] where Wrapped: Sequence { fatalError() }
}

Resolves rdar://problem/60658263
2020-04-06 11:43:14 -07:00
Arnold Schwaighofer
c34739ce45 Merge pull request #30828 from aschwaighofer/irgen_fix_private_opaque_type_descriptor
Opaque type substitution also needs to take the access of a opaque ty…
2020-04-06 11:19:19 -07:00
Nate Chandler
ab2d3e84ad Disabled tests failing from missing objc symbol.
Two tests are currently failing with

dyld: lazy symbol binding failed: Symbol not found: _objc_opt_self
  Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_opt_self
  Expected in: /usr/lib/libobjc.A.dylib

Here, they are disabled for now.

rdar://problem/61345988
2020-04-06 11:12:11 -07:00
Robert Widmann
ba97afc138 Fix the gates on a test that needs statistics
rdar://61348443
2020-04-06 11:00:26 -07:00
Xi Ge
8d0e38e364 test: disable Serialization/multi-file-type-eraser.swift for failing in public CI
rdar://61348443
2020-04-06 10:39:25 -07:00
Luciano Almeida
08904ffe3f [SR-12242] Apply to Arg involving ConstraintLocator::GenericArgument diagnostics improvement (#30814)
* [CSDiagnostics] Handle arg to param generic when locator points to ConstraintLocator::GenericArgument

* [test] Add SR-12242 test case

* [CSDiagnostics] Handle arg to param on Generic mismatch as a fallback diagnostic

* [CSDiagnostics] Make assign diagnostics in GenericMismatchFailure handle more cases

* [test] Adding test cases for assign expr in GenericMismatch diagnostics

* [CSDiagnostics] Improving inout to pointer argument conversions with optionals diagnostics
2020-04-06 10:25:02 -07:00
Hamish Knight
3339ea4f91 [CS] Fix invalid key path crasher
Previously we were bailing early on encountering
an optional chain in the key path. However this
could cause us to miss invalid components further
down the line. Instead, set a flag and force the
key path to be read-only if we encountered an
optional chain.

Resolves SR-12519.
2020-04-06 10:14:19 -07:00
Xi Ge
faf91d5cf6 test: disable stdlib/TestData.swift due to rdar://61347106 2020-04-06 10:13:37 -07:00
Xi Ge
70d119199c test: disable SourceKit/DocSupport/doc_swift_module_cross_import.swift
rdar://61346236
2020-04-06 09:53:11 -07:00