Commit Graph

11880 Commits

Author SHA1 Message Date
swift_jenkins
04c1567708 Merge remote-tracking branch 'origin/master' into master-next 2019-12-16 14:09:55 -08:00
Dan Zheng
c842fee0a4 [AutoDiff upstream] Add @transpose(of:) attribute.
The `@transpose(of:)` attribute registers a function as a transpose of another
function. This patch adds the `@transpose(of:)` attribute definition, syntax,
parsing, and printing.

Resolves TF-827.

Todos:
- Type-checking (TF-830, TF-1060).
- Enable serialization (TF-838).
- Use module-qualified names instead of custom qualified name syntax/parsing
  (TF-1066).
2019-12-16 12:23:08 -08:00
Robert Widmann
84ff97ac68 [NFC] Drop a dead overload of DynamicSubscriptExpr::create 2019-12-16 11:28:14 -08:00
Xi Ge
03fab30ee0 Merge branch 'master' into tbdgen-ld-hide 2019-12-14 20:57:05 -08:00
Xi Ge
5e30d0e02b sema: diagnose bad interactions between @available and @_originallyDefinedIn 2019-12-14 18:34:14 -08:00
swift_jenkins
59fa47cc7a Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 15:20:06 -08:00
Slava Pestov
ff294bdfb1 Merge pull request #28780 from slavapestov/sr-75-cleanups
A handful of cleanups in preparation for building curry thunks in Sema
2019-12-13 18:10:26 -05:00
swift_jenkins
d27b9fd05f Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 14:40:35 -08:00
Slava Pestov
7626f9de4f AST: Small cleanups
- Allow AbstractClosureExpr to be created with null body
- Split up ParameterList::CloneFlags::Inherited
2019-12-13 15:39:47 -05:00
Hamish Knight
36cecb4015 Requestify hasDynamicMemberLookupAttribute for Sema too
Previously we had a request for this in
IDETypeChecking, but this wasn't used for queries
made from Sema. Move the request into Sema, and
move `hasDynamicMemberLookupAttribute` onto
TypeBase.
2019-12-13 11:04:00 -08:00
swift_jenkins
821df072eb Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 08:00:43 -08:00
Xi Ge
66b4737ddc TBDGen: use active platform versions to genearate linker directives 2019-12-12 22:22:28 -08:00
Saleem Abdulrasool
dedde46df3 AST: explicitly indicate operator==
This is needed to build with VS2019:

```
swift\include\swift\AST\AutoDiff.h(172): error C2593: 'operator ==' is ambiguous
swift\include\swift\Basic\AnyValue.h(129): note: could be 'bool swift::operator ==(const swift::AnyValue &,const swift::AnyValue &)' [found using argument-dependent lookup]
swift\include\swift\AST\AutoDiff.h(172): note: or       'built-in C++ operator==(swift::AutoDiffDerivativeFunctionKind::innerty, swift::AutoDiffDerivativeFunctionKind::innerty)'
swift\include\swift\AST\AutoDiff.h(172): note: while trying to match the argument list '(const swift::AutoDiffDerivativeFunctionKind, const swift::AutoDiffDerivativeFunctionKind)'
```
2019-12-12 21:14:27 -08:00
swift_jenkins
e359fef156 Merge remote-tracking branch 'origin/master' into master-next 2019-12-12 18:19:55 -08:00
Dan Zheng
bb1052ca3e [AutoDiff upstream] Upstream @derivative attribute type-checking. (#28738)
The `@derivative` attribute registers a function as a derivative of another
function-like declaration: a `func`, `init`, `subscript`, or `var` computed
property declaration.

The `@derivative` attribute also has an optional `wrt:` clause specifying the
parameters that are differentiated "with respect to", i.e. the differentiation
parameters. The differentiation parameters must conform to the `Differentiable`
protocol.

If the `wrt:` clause is unspecified, the differentiation parameters are inferred
to be all parameters that conform to `Differentiable`.

`@derivative` attribute type-checking verifies that the type of the derivative
function declaration is consistent with the type of the referenced original
declaration and the differentiation parameters.

The `@derivative` attribute is gated by the
`-enable-experimental-differentiable-programming` flag.

Resolves TF-829.
2019-12-12 18:18:18 -08:00
swift_jenkins
cc083af78f Merge remote-tracking branch 'origin/master' into master-next 2019-12-12 18:00:14 -08:00
Varun Gandhi
a6f5c578e7 Merge pull request #28726 from varungandhi-apple/vg-fix-ClangTypeConverter.getFunctionType
Fix some problems in ClangTypeConverter::getFunctionType
2019-12-12 17:40:55 -08:00
swift_jenkins
7944d36a16 Merge remote-tracking branch 'origin/master' into master-next 2019-12-12 16:19:49 -08:00
Varun Gandhi
eabe7bcc76 [AST] Wrap converted clang::FunctionType values in clang::PointerType. 2019-12-12 14:24:46 -08:00
Dan Zheng
63ce61b9aa [AutoDiff] NFC: Use consistent headers for IndexSubset.{h,cpp}.
Left-align headers. Use consistent message. Use accurate year in copyright.
2019-12-12 14:23:28 -08:00
swift_jenkins
6b53fd184c Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 11:00:08 -08:00
Brent Royal-Gordon
6a8598a99c [NFC] Remove DeclNameRef staging calls 2019-12-11 00:55:18 -08:00
Brent Royal-Gordon
addbe3e5ed [NFC] Thread DeclNameRef through most of the compiler
This huge commit contains as many of the mechanical changes as possible.
2019-12-11 00:55:18 -08:00
Brent Royal-Gordon
da88512eda [NFC] Take DeclNameRef in UnqualifiedLookup and lookupQualified() 2019-12-11 00:55:17 -08:00
Brent Royal-Gordon
9a57554bdf [NFC] DeclNameRef-ify qualified and unqualified lookup 2019-12-11 00:55:17 -08:00
Brent Royal-Gordon
4b9a219d4f [NFC] Add DeclNameRef type to the compiler
This type wraps a DeclName, indicating that it is a reference to a declaration that exists somewhere else and it requires slightly “fuzzy” comparison (i.e. if it’s not compound, only the base names should be compared). DeclName::matchesRef() and MemberLookupTable::find() both now take a DeclNameRef instead of a DeclName.

This commit temporarily allows implicit conversion from DeclName; I’ll flip the switch on that in a later commit.
2019-12-11 00:45:08 -08:00
Brent Royal-Gordon
4afffbeb5c [NFC] Document a weird designated types-related accessor
This feature is barely used and needs refactoring that would be outside the scope of this series of commits (see https://bugs.swift.org/browse/SR-11241).
2019-12-11 00:45:08 -08:00
Brent Royal-Gordon
1df792ae9f [NFC] Convert TypeRepr to use DeclName(Loc)?
Replaces `ComponentIdentTypeRepr::getIdentifier()` and `getIdLoc()` with `getNameRef()` and `getNameLoc()`, which use `DeclName` and `DeclNameRef` respectively.
2019-12-11 00:45:08 -08:00
Brent Royal-Gordon
4c41794c9d [NFC] Add a spare bit to Identifier
So that DeclName can have a spare bit, allowing it to be used in places where we’re currently using PointerIntPair<Identifier, 1> or PointerUnion<Identifier, Whatever>.
2019-12-11 00:45:08 -08:00
Brent Royal-Gordon
8551b32af2 [NFC] Make EnumElementPattern carry a DeclName
This has the side effect of threading compound name support through more enum pattern code, although it’s still not complete.
2019-12-11 00:45:07 -08:00
Brent Royal-Gordon
a3035eb925 [NFC] Add helpers for unresolved AST node synthesis
This change adds UnresolvedDotExpr::createImplicit() and UnresolvedDeclRefExpr::createImplicit() helpers. These calls simplify several tedious bits of code synthesis that would otherwise become even more tedious with DeclNameRef in the picture.
2019-12-11 00:45:07 -08:00
swift_jenkins
234bd8784e Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 00:00:34 -08:00
Robert Widmann
acf282bc3d Merge pull request #28689 from hamishknight/lookup-requests
[NameLookup] Add requests for module and AnyObject lookup (master)
2019-12-10 23:54:51 -08:00
swift_jenkins
3140acc993 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 21:20:05 -08:00
Robert Widmann
785bda0250 Discard ResolveEncodable and ResolveDecodable 2019-12-10 16:28:51 -08:00
Robert Widmann
fbdd907a1f Add a way to just synthesize CodingKeys 2019-12-10 16:28:51 -08:00
Robert Widmann
06d27f08fd Define @_implicitly_synthesizes_nested_requirement
State the previously unstated nested type requirement that CodingKeys adds to the witness requirements of a given type. The goal is to make this member cheap to synthesize, and independent of the expensive protocol conformance checks required to append it to the member list.

Further, this makes a clean conceptual separation between what I'm calling "nested type requirements" and actual type and value requirements.

With luck, we'll never have to use this attribute anywhere else.
2019-12-10 16:28:50 -08:00
swift_jenkins
51b2144406 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 16:20:02 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Joe Groff
84e20b630e SIL parser support for substituted function types 2019-12-10 12:08:42 -08:00
Joe Groff
8a45d5a518 Mangler: Support substituted SIL function types in thunk manglings 2019-12-10 12:08:42 -08:00
Dan Zheng
0585eb0e90 [AutoDiff upstream] Add @derivative(of:) attribute. (#28321)
The `@derivative(of:)` attribute registers a function as a derivative of another
function. This patch adds the `@derivative(of:)` attribute definition, syntax,
parsing, and printing.

Resolves TF-826.

Todos:
- Type-checking (TF-829).
- Serialization (TF-837).
2019-12-10 09:29:43 -08:00
Dan Zheng
67423687b0 [AutoDiff] NFC: @differentiable attribute gardening. (#28666)
- Move `DifferentiableAttr` definition above `DeclAttributes` in
  include/swift/AST/Attr.h, like other attributes.
- Remove unnecessary arguments from `DifferentiableAttr::DifferentiableAttr`
  and `DifferentiableAttr::setDerivativeGenericSignature`.
- Add libSyntax test for `@differentiable` attributes.
2019-12-09 20:53:38 -08:00
Varun Gandhi
3cc452eee8 Merge pull request #28479 from varungandhi-apple/vg-allow-clang-types-in-convention-attr
Allow spelling out a C type in the convention attribute.
2019-12-09 18:36:56 -08:00
Holly Borla
edb4e70d66 Merge pull request #28600 from hborla/tuple-mismatch-diagnostics
[ConstraintSystem] Port tuple type mismatch diagnostics
2019-12-09 13:26:34 -08:00
Robert Widmann
7c46df68c7 Merge pull request #28633 from kitaisreal/classes-equatable-hashable-synthesis-diagnostics
[Type checker]: Classes `Hashable` and `Equatable` synthesis diagnostic
2019-12-09 13:16:18 -08:00
Holly Borla
94e9fd1d67 [Diagnostics] Use a generic "tuple type not convertible" error message
when there is no contextual type.
2019-12-09 11:25:32 -08:00
Kita, Maksim
00bc7f48c0 SR-11902: Fixed code review issues 2019-12-07 20:35:49 +03:00
Kita, Maksim
9963fce1f7 SR-11902: Fixed code review issues. Updated tests. 2019-12-07 15:23:31 +03:00
Kita, Maksim
7458016f22 SR-11902: Fixed code review issues 2019-12-07 14:29:10 +03:00