Commit Graph

58361 Commits

Author SHA1 Message Date
Suyash Srijan
724f8c23db [Typechecker] Implement SE-0268 Refine didSet Semantics (#26632) 2020-04-09 01:23:15 +01:00
Pavel Yaskevich
6f83c08aae [Diagnostics] Remove obsolete getResolvedMemberRef 2020-04-08 16:09:08 -07:00
Pavel Yaskevich
deb58e0b68 Merge pull request #30022 from LucianoPAlmeida/SR-9839-convention-function-conversions-fail
[SR-9839] Fixes ambiguity in convention function argument inference
2020-04-08 15:48:51 -07:00
Pavel Yaskevich
a84e0b70fc [Diagnostics] Obsolete and remove HasComplexLocator field from diagnostic
This was useful when CSDiag was still in play but since everything
has been ported this is no longer useful.
2020-04-08 15:03:42 -07:00
swift-ci
7068536a37 Merge pull request #30893 from ravikandhadai/emit-code-conditioned-on-creation-loc 2020-04-08 14:58:14 -07:00
Holly Borla
008b33ecb3 Merge pull request #30896 from hborla/property-wrapper-invalid-redeclaration
[Property Wrappers] Improve error recovery in buildStorageReference.
2020-04-08 14:50:25 -07:00
Andrew Trick
d951279e53 Merge pull request #30892 from atrick/silcombine-builtin-same-metatype
Add Builtin.is_same_metatype to SILCombine.
2020-04-08 14:48:13 -07:00
Dan Zheng
9cfe91aa01 Merge pull request #30877 from dan-zheng/SR-12548-fix
[SILOptimizer] Disable `SILCombiner::visitPartialApplyInst` for method callees.
2020-04-08 14:09:58 -07:00
Luciano Almeida
426a2f8694 [ConstraintSystem] Checking for SK_Fix when diagnose ambiguity for generic parameter bindings with no fixes 2020-04-08 17:51:45 -03:00
Dario Rexin
e4e6c16319 Fix linker flags for -static-executable
Also adds a test to ensure it does not break in the future
2020-04-08 13:25:27 -07:00
Luciano Almeida
2704b6d737 [ConstraintSystem] Diagnose ambiguity for generic parameter bindings with no fixes 2020-04-08 17:16:47 -03:00
Dan Zheng
73f0560af5 [AutoDiff] Standardize on "differentiability parameter" terminology.
Change "differentiation parameter" to "differentiability parameter", matching
terminology in docs/DifferentiableProgramming.md.
2020-04-08 13:01:17 -07:00
Holly Borla
32c338f465 [Property Wrappers] Improve error recovery in buildStorageReference.
Bail out if the backing storage has an error type. This can happen
if there's an invalid redeclaration of the property wrapper, for
example.
2020-04-08 12:45:32 -07:00
Nathan Lanza
abf520f902 Merge pull request #30884 from enferex/use-explicit-stringref
[siloptimizer] Use .str() on StringRef.
2020-04-08 15:23:35 -04:00
Nathan Hawes
df3b6a83bb [SourceKit/CodeFormat] Don't modify multiline string indentation regardless of it being column-aligned or not.
Resolves rdar://problem/61463947
2020-04-08 12:11:48 -07:00
Ravi Kandhadai
fb943cca8a [OSLogOptimization] Make emitCodeForSymbolicValue function generate
code for closures iff the closure is not created by the caller function
where the code is generated. Otherwise, when the closure is created
by the caller, just reuse it after copying and extending its lifetime.

Before this change new closures were created as long as all captures
of the closures were symbolic constants. This patch updates it so that
even if all captures are symbolic constants no code is generated for
closures that are already available in the caller. This avoids doing
needless work and also fixes the following bug.

<rdar://problem/61465764>
2020-04-08 11:53:52 -07:00
Brent Royal-Gordon
4de19e1c3c Merge pull request #30819 from brentdax/a-less-ambitious-crossover-event
Ignore transitive ObjC imports when cross-importing
2020-04-08 11:40:35 -07:00
Andrew Trick
ba75b3b3fb Add Builtin.is_same_metatype to SILCombine.
To optimize String decoding.
2020-04-08 11:34:22 -07:00
Dan Zheng
2eb460de4d [AutoDiff upstream] Add forward-mode differentiation. (#30878)
JVP functions are forward-mode derivative functions. They take original
arguments and return original results and a differential function. Differential
functions take derivatives wrt arguments and return derivatives wrt results.

`JVPEmitter` is a cloner that emits JVP and differential functions at the same
time. In JVP functions, function applications are replaced with JVP function
applications. In differential functions, function applications are replaced
with differential function applications.

In JVP functions, each basic block takes a differential struct containing callee
differentials. These structs are consumed by differential functions.
2020-04-08 11:29:21 -07:00
Andrew Trick
b5570a1aa9 Merge pull request #30872 from atrick/cse-init-existential-metatype
Add init_existential_metatype to CSE.
2020-04-08 11:06:26 -07:00
Nathan Hawes
25d531c842 Merge pull request #30856 from nathawes/dont-process-group-name
[Index] Don't replace ' ' or '-' in group names when mapping them to a 'module' name
2020-04-08 10:42:25 -07:00
nate-chandler
bc2f571d19 Merge pull request #30880 from nate-chandler/generic-metadata-prespecialization-components/disable-for-stdlib
[metadata prespecialization] Not always on for stdlib.
2020-04-08 10:24:16 -07:00
Nathan Hawes
c6a06e0feb [SourceKit/CodeFormat] Column-align enum element decls and the items in their parameter lists.
Resolves rdar://problem/61461022
2020-04-08 10:16:59 -07:00
Pavel Yaskevich
51267754fc Merge pull request #30867 from xedin/rdar-59874355
[TypeChecker] Diagnose key paths with contextual type but no leading dot
2020-04-08 10:05:35 -07:00
eeckstein
c4e7bee0af Merge pull request #30874 from eeckstein/fix-dce
DeadCodeElimination: replace recursive post-dominator walks with iterative worklist algorithms.
2020-04-08 19:03:35 +02:00
Nathan Hawes
19d6effc5e [SourceKit/CodeFormat] Column-align multiple patterns in catch clauses.
Catch clauses now support mutliple patterns. Like 'case' patterns, these
should be column-aligned if split across multiple lines.

do {
  ...
} catch MyErr.a(let x),
        MyErr.b(let x) {
  print("hello")
}
2020-04-08 09:46:09 -07:00
Matt Davis
e76be9e4b5 [siloptimizer] Use .str() on StringRef.
llvm recently removed the conversion operator that would convert
StringRef into str() implictly.  Now we have to be more explicit.
See: adcd026838
2020-04-08 09:42:06 -07:00
AG
4e85c51b07 Merge pull request #30857 from bitjammer/acgarland/rdar-60796811-rootmost-extension-sgf
[SymbolGraph] Put extending declarations in rootmost module
2020-04-08 09:41:25 -07:00
Nate Chandler
240fd09364 [metadata prespecialization] Not always on for stdlib.
Prespecializing metadata in the stdlib looks to be exposing a bug in its
implementation.  Disabling for now.
2020-04-08 08:07:49 -07:00
Dan Zheng
606c070e11 [SILOptimizer] Disable SILCombiner::visitPartialApplyInst for method callees.
Disable `SILCombiner::visitPartialApplyInst` from rewriting `partial_apply` with
with `@convention(method)` callee to `thin_to_thick_function`.

This fixes SIL verification errors: `thin_to_thick_function` only supports
`@convention(thin)` operands.

Resolves SR-12548.
2020-04-08 12:40:44 +00:00
Erik Eckstein
380db3761a DeadCodeElimination: replace recursive post-dominator walks with iterative worklist algorithms.
This fixes stack-overflow crashes when compiling large functions.

rdar://problem/56268570
2020-04-08 11:46:51 +02:00
Dan Zheng
6f4b812164 [AutoDiff upstream] Fix LinearMapInfo result indices calculation.
Result indices capacity should equal original function "semantic result" count
(formal results and `inout` parameters), not just the formal result count.

Fixes `inout` parameter differentiation.
2020-04-08 00:24:42 -07:00
Dan Zheng
a282ee622b [AutoDiff] NFC: silence unused variable warnings. 2020-04-08 00:10:12 -07:00
Dan Zheng
f27f1cde66 Merge pull request #30863 from dan-zheng/synthesized-file-unit
[AutoDiff] Add generated implicit declarations to SynthesizedFileUnit.
2020-04-07 23:48:09 -07:00
Andrew Trick
a22d0f229c Add init_existential_metatype to CSE.
So String decoding can be optimized.
2020-04-07 21:16:21 -07:00
Andrew Trick
91a425ee80 Merge pull request #30868 from atrick/simplify-metatype
Simplify metatype instructions.
2020-04-07 20:43:03 -07:00
Artem Chikin
0d1013245e Merge pull request #30782 from artemcm/Rcross-import
Add -Rcross-import option
2020-04-07 19:04:47 -07:00
Hamish Knight
76881a39a5 [CS] Adjust applied overload simplification (#30716)
[CS] Adjust applied overload simplification
2020-04-07 19:04:27 -07:00
Dan Zheng
de4deb5867 [AutoDiff] Lazily create synthesized file during differentiation.
Make `ADContext` lazily create a `SynthesizedFileUnit` instead of creating one
during `ADContext` construction. This avoids always creating a
`SynthesizedFileUnit` in every module, since differentiation is a mandatory
transform that always runs.

It was nonetheless useful to test always creating a `SynthesizedFileUnit` for
testing purposes.
2020-04-07 18:45:41 -07:00
Dan Zheng
f7a9eed4de [AutoDiff] Add generated implicit declarations to SynthesizedFileUnit.
Add implicit declarations generated by the differentiation transform to a
`SynthesizedFileUnit` instead of an ad-hoc pre-existing `SourceFile`.

Resolves TF-1232: type reconstruction for AutoDiff-generated declarations.

Previously, type reconstruction failed because retroactively adding declarations
to a `SourceFile` did not update name lookup caches.
2020-04-07 18:29:34 -07:00
Dan Zheng
c834696bfa Add SynthesizedFileUnit.
`SynthesizedFileUnit` is a container for synthesized declarations. Currently, it
only supports module-level declarations.

It is used by the SIL differentiation transform, which generates implicit struct
and enum declarations.
2020-04-07 18:29:26 -07:00
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
Owen Voorhees
5213bec4d2 [Sema] Eliminate duplication in CaseStmt typechecking for switch and do-catch statements 2020-04-07 17:56:39 -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
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
Pavel Yaskevich
3accb65a5c [AST] Track whether key path expression has a leading dot
This is going to be useful to detect whether contextual root
is really expected during key path resolution in Sema.
2020-04-07 16:16:34 -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