Commit Graph

11880 Commits

Author SHA1 Message Date
swift-ci
c10a5f7cb1 Merge remote-tracking branch 'origin/master' into master-next 2019-11-11 14:10:53 -08:00
Gogul Balakrishnan
5accda22b2 [AutoDiff upstream] Introduce @differentiable attribute to mark functions as differentiable. (#27506)
This PR introduces `@differentiable` attribute to mark functions as differentiable. This PR only contains changes related to parsing the attribute. Type checking and other changes will be added in subsequent patches.

See https://github.com/apple/swift/pull/27506/files#diff-f3216f4188fd5ed34e1007e5a9c2490f for examples and tests for the new attribute.
2019-11-11 13:58:34 -08:00
Hamish Knight
01d5c00f9b [Sema] Requestify default arg type checking
This commit introduces a request to type-check a
default argument expression and splits
`getDefaultValue` into 2 accessors:

- `getStructuralDefaultExpr` which retrieves the
potentially un-type-checked default argument
expression.

- `getTypeCheckedDefaultExpr` which retrieves a
fully type-checked default argument expression.

In addition, this commit adds `hasDefaultExpr`,
which allows checking for a default expr without
kicking off a request.
2019-11-11 13:49:06 -08:00
Hamish Knight
7ae3d1f8d3 Requestify default initializer context creation
This commit adds a request that computes
the initializer context for a parameter with a
default expr or stored property default.

This avoids having to compute them for synthesized
decls and is a step towards requestifying default
argument parsing.
2019-11-11 13:49:06 -08:00
Hamish Knight
4d216c7052 [AST] Add swift::getParameterList 2019-11-11 13:49:05 -08:00
swift-ci
05aca13575 Merge remote-tracking branch 'origin/master' into master-next 2019-11-11 13:10:47 -08:00
Robert Widmann
cab4e9f011 Eagerly TypeCheck Synthesized Decls 2019-11-11 11:34:52 -08:00
Robert Widmann
2f2b8afad8 Remove the list of synthesized decls"
This used to be a lot more relevant a long time ago when typeCheckFunctionsAndExternalDecls actually did type check external functions defined in C.  Now, it serves no purpose.

The validation order change from just type checking these things eagerly doesn't seem to affect anything.
2019-11-11 11:33:59 -08:00
Holly Borla
212f20245a [ConstraintSystem] Add TypeBase::hasHole to be used by the constraint
system. Eventually, this will replace TypeBase::hasUnresolvedType.
2019-11-11 10:08:25 -08:00
Hamish Knight
eacca4ed0c Requestify circular inheritance checking
Add requests for checking whether a class,
protocol, or enum have circular references in
their inheritance lists.
2019-11-11 09:34:56 -08:00
Hamish Knight
9e77d31d6e NFC: Fix ClassDecl inline bitfield count 2019-11-11 09:34:55 -08:00
swift-ci
23d48be787 Merge remote-tracking branch 'origin/master' into master-next 2019-11-10 23:50:36 -08:00
Robert Widmann
5a1cae119e Merge pull request #28171 from CodaFi/one-one-ten-ded-consequences
Partially Revert #27862
2019-11-10 23:47:05 -08:00
Robert Widmann
dd1b15775d Partially Revert #27862
When SE-110 was being implemented, we accidentally began to accept
closure parameter declarations that had no associated parameter names,
e.g.

foo { ([Int]) in /**/ }

This syntax has never been sanctioned by any version of Swift and should
be banned.  However, the change was made long enough ago and there are
enough clients relying on this, that we cannot accept the source break
at the moment.  For now, add a bit to ParamDecl that marks a parameter
as destructured, and back out setting the invalid bit on the type repr
for these kinds of declarations.

To prevent further spread of this syntax, stub in a warning that offers
to insert an anonymous parameter.

Resolves part of rdar://56673657 and improves QoI for errors like
rdar://56911630
2019-11-10 22:10:53 -08:00
swift-ci
8ad621275f Merge remote-tracking branch 'origin/master' into master-next 2019-11-10 17:10:41 -08:00
Robert Widmann
301e042121 Add PreCheckFunctionBuilderRequest
Drop a cache out of the type checker.
2019-11-10 14:18:54 -08:00
swift-ci
68128384a3 Merge remote-tracking branch 'origin/master' into master-next 2019-11-08 13:30:07 -08:00
Owen Voorhees
caa6316257 Merge pull request #28052 from owenv/educational-notes
[Diagnostics] Introduce "Educational Notes" for diagnostics
2019-11-08 13:19:44 -08:00
swift-ci
0eaef36fa7 Merge remote-tracking branch 'origin/master' into master-next 2019-11-08 12:49:23 -08:00
Suyash Srijan
e33ed77d5d Merge pull request #28135 from theblixguy/fix/SR_5115
[MiscDiagnostics] Diagnose passing a non-@objc dynamic KeyPath property to KVO observe
2019-11-08 20:35:55 +00:00
Suyash Srijan
fab6ce9587 [MiscDiagnostics] Diagnose passing a non-@objc dynamic KeyPath property to KVO observe method 2019-11-08 18:52:43 +00:00
swift-ci
fd19bbe1d1 Merge remote-tracking branch 'origin/master' into master-next 2019-11-07 22:09:47 -08:00
Robert Widmann
110b76e3bd Merge pull request #28123 from AnthonyLatsis/whereclauseowner-cleanup
NFC: Clean up WhereClauseOwner
2019-11-07 21:50:16 -08:00
Owen Voorhees
ac05a66938 [Diagnostics] Introduce "Educational Notes" for diagnostics
Educational notes are small pieces of documentation which explain a concept
relevant to some diagnostic message. If -enable-descriptive-diagnostics is
passed, they will be printed after a diagnostic message if available.

Educational notes can be found at /usr/share/doc/diagnostics in a
toolchain, and are associated with specific compiler diagnostics in
EducationalNotes.def.
2019-11-07 13:18:35 -08:00
swift-ci
8f128e0e19 Merge remote-tracking branch 'origin/master' into master-next 2019-11-07 12:49:07 -08:00
Anthony Latsis
bf91cf9a8e Clean up WhereClauseOwner 2019-11-07 21:26:31 +03:00
Hamish Knight
18088b04f0 [AST] Consolidate Obj-C types on ASTContext
This commit moves the getNSObjectType and
getObjCSelectorType methods from TypeChecker
onto ASTContext. In addition, it moves the
FOR_KNOWN_FOUNDATION_TYPES macro into a separate
file to define each of the Obj-C type decls
we want to have access to.
2019-11-07 08:26:08 -08:00
swift-ci
547a215b1e Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 12:29:17 -08:00
David Ungar
5ee492834d Merge pull request #28075 from davidungar/rdar-54906120-health-bug
[NameLookup, ASTScope] Eagerly expand function bodies before type-checking them
2019-11-06 12:21:09 -08:00
swift-ci
e64776d49e Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 11:49:25 -08:00
Michael Gottesman
3a4c4d09e2 Merge pull request #28100 from gottesmm/pr-b169c1785bc8360aa9d4661c79b7061aec94e6a5
[semantics] Add support for annotating VarDecls with @_semantics.
2019-11-06 11:32:43 -08:00
Dan Zheng
53e61a9587 [AutoDiff upstream] Add the _Differentiation module. (#27511)
The `_Differentiation` module is the experimental support library for
differentiable programming. It is built when the build-script flag
`--enable-experimental-differentiable-programming` is enabled.

The `Differentiable` protocol generalizes all types that work with
differentiation. It is a core piece of the differentiable programming
project. Other parts depending on the `Differentiable` protocol will
be upstreamed piece by piece.

The `Differentiable` protocol is compiler-known and will be used during
type-checking, SILGen, and the SIL differentiation transform.
2019-11-06 11:31:12 -08:00
David Ungar
87799339c7 Eagerly expand function bodies before type-checking them, which scrambles them. 2019-11-06 10:36:14 -08:00
swift-ci
3a97d96bfb Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 00:49:28 -08:00
David Ungar
069db6e661 Merge pull request #28038 from davidungar/rdar-56760957-dont-do-ide-lookups-into-inactive-clauses
[SourceKit NameLookup] Don't walk into inactive clauses.
2019-11-06 00:40:20 -08:00
swift-ci
72362c9c8d Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 00:29:57 -08:00
Pavel Yaskevich
6d02fb7815 Merge pull request #28057 from xedin/assign-diags
[Diagnostics] Port the rest of assignment diagnostics to the new framework
2019-11-06 00:11:08 -08:00
swift-ci
ecedea9231 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 22:29:55 -08:00
Robert Widmann
e907d3bc52 [NFC] Remove the TypeChecker from Typo Correction 2019-11-05 20:29:36 -08:00
swift-ci
ad3ea35608 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 20:10:09 -08:00
Robert Widmann
06378aebcd Merge pull request #28092 from CodaFi/typing-of-the-dead
Kill the LazyResolver
2019-11-05 19:54:39 -08:00
swift-ci
a92177ae25 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 17:49:35 -08:00
Hamish Knight
10d62a1e4e [CSDiagnostics] Allow non-ephemeral diag to refer to argument… (#28084)
[CSDiagnostics] Allow non-ephemeral diag to refer to argument labels
2019-11-05 17:43:39 -08:00
Suyash Srijan
3ecc13b360 Merge pull request #28015 from nexon/SR-11679-incorrect-fix-suggestion-cftypes
SR-11679: Incorrect FixIt suggestion for CFTypes
2019-11-06 01:32:55 +00:00
Michael Gottesman
fe257d58a7 [semantics] Add support for annotating VarDecls with @_semantics.
This is just for prototyping purposes. I also had to loosen a small restriction
where semantics functions were not allowed in local contexts. There really is no
reason to enforce this and I think since it came in the first commit that
introduced semanitcs it was most likely NadavR just being conservative and
careful.
2019-11-05 17:31:58 -08:00
swift-ci
cc8f59a38e Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 15:50:04 -08:00
Joe Groff
0fc8377159 Merge pull request #28065 from apple/subst-function-type-value-lowering
SIL: Type lowering for function values with substituted SIL function types.
2019-11-05 15:36:37 -08:00
Robert Widmann
2b08d1b834 [NFC] ASTContext::getLazyResolver -> ASTContext::getLegacyGlobalTypeChecker 2019-11-05 14:44:41 -08:00
Robert Widmann
56a713f179 Remove LazyResolver! 2019-11-05 14:43:12 -08:00
Hamish Knight
96e5f2a145 Allow non-ephemeral diag to refer to argument labels
Use getArgDescription to improve the diagnostic
for invalid temporary pointer conversions.
2019-11-05 13:51:53 -08:00