Commit Graph

1344 Commits

Author SHA1 Message Date
Brent Royal-Gordon
cff4ddf13a [NFC] Adopt new ImportPath types and terminology
# Conflicts:
#	lib/IDE/CodeCompletion.cpp
2020-09-10 19:07:49 -07:00
Holly Borla
3332df6f89 Merge pull request #33777 from hborla/rename-storage-wrapper
[NFC][Property Wrappers] Rename "storage wrapper var" to "projection var/projected value"
2020-09-03 18:29:04 -07:00
Holly Borla
3fd882cadf [NFC] Rename "storage wrapper var" to "projection var" or "projected value"
in property wrapper-related code.
2020-09-02 18:07:40 -07:00
swift_jenkins
fb946baf59 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-28 11:08:22 -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
Pavel Yaskevich
78ea3de8e4 [AST] Introduce a new type to represent a type hole in constraint system
Instead of using `UnresolvedType` as a placeholder for a type hole,
let's switch over to a dedicated "rich" `HoleType` which is capable
of storing "originator" type - type variable or dependent member
type which couldn't be resolved.

This makes it easier for the solver to determine origins of
a hole which helps to diagnose certain problems better. It also
helps code completion to locate "expected type" of the context
even when it couldn't be completely resolved.
2020-08-26 16:55:39 -07:00
swift_jenkins
3134f7e170 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-24 20:25:48 -07:00
Slava Pestov
995eb66aa7 AST: Rename SpecializeAttr::getSpecializedSgnature() 2020-08-24 19:16:36 -04:00
Nathan Hawes
280d4c995a Merge remote-tracking branch 'upstream/master' into HEAD 2020-08-21 22:23:58 -07:00
Alexis Laferrière
2f7e0d496f Revert "Revert "[Serialization] Serialize isUserAccessible on functions""
This reverts commit bf25a01701.
2020-08-20 16:23:57 -07:00
swift_jenkins
8cfd9be2cb Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-19 15:06:17 -07:00
Nate Chandler
9b8828848d [SIL] Add SILFunctionType flag for async. 2020-08-19 11:29:58 -07:00
swift_jenkins
54abd7b0be Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-18 13:12:21 -07:00
Alexis Laferrière
bf25a01701 Revert "[Serialization] Serialize isUserAccessible on functions"
This reverts commit f523c88754.
2020-08-18 09:31:32 -07:00
swift_jenkins
9ab003bcf9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-14 15:14:01 -07:00
Alexis Laferrière
f523c88754 [Serialization] Serialize the isUserAccessible bit on functions
rdar://problem/53891642
SR-7460
2020-08-14 09:50:31 -07:00
Nathan Hawes
51beab6889 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	test/DebugInfo/modulecache.swift
2020-08-13 11:16:33 -07:00
Yuta Saito
d913e57d84 [Serialization] Serialize Differentiability WT index sorted
When there are sil_property and sil_differentiability_witness at once,
serialized file couldn't be deserialized because it's index table is
serialized un-sortedly but deserializer assumes that contents of table
index are sorted.

This patch fixes the un-sorted serialization and adds test case to
ensure that table index contents can be deserialized
2020-08-07 08:49:26 +09:00
Nathan Hawes
607e2b8822 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 13:47:48 -07:00
Varun Gandhi
3882beb85d [NFC] Use consistent naming scheme for predicate methods. (#33265)
bool throws() -> isThrowing(), bool async() -> isAsync()
2020-08-03 16:37:29 -07:00
Varun Gandhi
f219e58ada [NFC] Refactor ExtInfo to use a builder-pattern based API.
Since the two ExtInfos share a common ClangTypeInfo, and C++ doesn't let us
forward declare nested classes, we need to hoist out AnyFunctionType::ExtInfo
and SILFunctionType::ExtInfo to the top-level.

We also add some convenience APIs on (AST|SIL)ExtInfo for frequently used
withXYZ methods. Note that all non-default construction still goes through the
builder's build() method.

We do not add any checks for invariants here; those will be added later.
2020-07-31 13:55:55 -07:00
swift-ci
0d8e3e1d71 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-29 09:14:39 -07:00
Doug Gregor
f6e9f352f0 [Concurrency] Add async to the Swift type system.
Add `async` to the type system. `async` can be written as part of a
function type or function declaration, following the parameter list, e.g.,

  func doSomeWork() async { ... }

`async` functions are distinct from non-`async` functions and there
are no conversions amongst them. At present, `async` functions do not
*do* anything, but this commit fully supports them as a distinct kind
of function throughout:

* Parsing of `async`
* AST representation of `async` in declarations and types
* Syntactic type representation of `async`
* (De-/re-)mangling of function types involving 'async'
* Runtime type representation and reconstruction of function types
involving `async`.
* Dynamic casting restrictions for `async` function types
* (De-)serialization of `async` function types
* Disabling overriding, witness matching, and conversions with
differing `async`
2020-07-27 18:18:03 -07:00
Nathan Hawes
9d4ed5f39c Manually merge remote-tracking branch 'upstream/master' into manually-merge-master-to-master-rebranch 2020-07-20 16:09:55 -07:00
Michael Gottesman
d2f986739c Merge pull request #32940 from gottesmm/pr-8414ddbc369ed5bb8c0622162de920b962426cf1
[ast] Rename VarPattern -> BindingPattern.
2020-07-18 20:47:21 -07:00
Brent Royal-Gordon
4394e92c3f Merge pull request #32700 from brentdax/magical-and-evolutionary
Revise #file changes from SE-0274
2020-07-17 01:57:23 -07:00
Michael Gottesman
092edd6621 [ast] Rename VarPattern -> BindingPattern.
VarPattern is today used to implement both 'let' and 'var' pattern bindings, so
today is already misleading. The reason why the name Var was chosen was done b/c
it is meant to represent a pattern that performs 'variable binding'. Given that
I am going to add a new 'inout' pattern binding to this, it makes sense to
give it now a better fitting name before I make things more confusing.
2020-07-16 18:56:01 -07:00
Robert Widmann
638977454b Remove SharedTimer Infrastructure
Teach the UnifiedStatsReporter to directly construct
llvm::NamedRegionTimer for itself.
2020-07-16 17:35:50 -07:00
Brent Royal-Gordon
9a838bb654 Differentiate between Swift 5 and “Swift 6” #file
In -swift-version 5 and earlier, #file will continue to be a synonym for #filePath; in a future -swift-version (“Swift 6 mode”), it will become a synonym for #fileID. #file in libraries will be interpreted according to the language mode the library was compiled in, not the language mode its client uses.

Implement this behavior, tied to a frontend flag instead of a language version. We do so by splitting the old `MagicIdentifierLiteralExprKind::File` into two separate cases, `FileIDSpelledAsFile` and `FilePathSpelledAsFile`, and propagating this distinction throughout the AST. This seems cleaner than looking up the setting for the module the declaration belongs to every time we see `File`.

This doesn’t handle module interfaces yet; we’ll take care of those in a separate commit.
2020-07-13 14:06:55 -07:00
Brent Royal-Gordon
0e569f5d9e Add support for #fileID
This temporarily breaks -enable-experimental-concise-pound-file.

fixup adding #fileID
2020-07-13 14:05:13 -07:00
Dan Zheng
bf47403162 [AutoDiff] Serialize and print @derivative and @transpose accessor kind. (#32839)
Serialize and print the optional accessor kind in `@derivative` and `@transpose`
attributes.

Resolves TF-1293.
2020-07-12 15:04:49 -07:00
Nathan Hawes
4fd0cdc2ef Fix up calls to clang::Type::dump() now that it requires a clang::ASTContext. 2020-07-07 15:05:34 -07:00
swift_jenkins
63f5e3401f Merge remote-tracking branch 'origin/master' into master-next 2020-07-01 08:39:15 -07:00
David Zarzycki
fae2c19edb NFC: Make SILType.h and SILDeclRef.h not depend on SIL/*.h
SILType and SILDeclRef do not actually need anything from SIL/*.h. Also,
a few dependencies can be pushed out of the headers into cpp files to
speed up incremental rebuilds.
2020-07-01 08:05:58 -04:00
swift_jenkins
75bea14185 Merge remote-tracking branch 'origin/master' into master-next 2020-06-23 10:39:14 -07:00
Robert Widmann
0da060e95e Merge pull request #32447 from martinboehme/option-set-initializer-list
Give OptionSet an initializer_list constructor
2020-06-23 10:36:57 -07:00
Martin Boehme
d806ba53f6 Give OptionSet an initializer_list constructor.
This makes it easier to specify OptionSet arguments.

Also modify appropriate uses of ModuleDecl::ImportFilter to take
advantage of the new constructor.
2020-06-22 06:57:29 +02:00
swift_jenkins
abb1d170fc Merge remote-tracking branch 'origin/master' into master-next 2020-06-11 00:38:31 -07:00
Robert Widmann
fb8fdd9644 Replace resolveCustomAttrType with a Request 2020-06-10 19:31:41 -07:00
swift_jenkins
48530ac212 Merge remote-tracking branch 'origin/master' into master-next 2020-06-10 10:39:00 -07:00
Arnold Schwaighofer
825a2a259b Mark non-foreign entry points of @objc dynamic methods in generic classes dynamically_replaceable
```
class Generic<T> {
  @objc dynamic func method() {}
}

extension Generic {
  @_dynamicReplacement(for:method())
  func replacement() {}
}
```

The standard mechanism of using Objective-C categories for dynamically
replacing @objc methods in generic classes does not work.

Instead we mark the native entry point as replaceable.

Because this affects all @objc methods in generic classes (whether there
is a replacement or not) by making the native entry point
`[dynamically_replaceable]` (regardless of optimization mode) we guard this by
the -enable-implicit-dynamic flag because we are late in the release cycle.

* Replace isNativeDynamic and isObjcDynamic by calls to shouldUse*Dispatch and
  shouldUse*Replacement
  This disambiguates between which dispatch method we should use at call
  sites and how these methods should  implement dynamic function
  replacement.

* Don't emit the method entry for @_dynamicReplacement(for:) of generic class
  methods
  There is not way to call this entry point since we can't generate an
  objective-c category for generic classes.

rdar://63679357
2020-06-09 09:23:29 -07:00
David Zarzycki
4be1192904 Keep master-next building and tested 2020-06-09 06:05:05 -04:00
Karoy Lorentey
57ea964f2c Merge commit '3eb82c183662945687f48e11c09828f551b34858' into master-next
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:58:37 -07:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
Karoy Lorentey
1c9b0908e6 Merge remote-tracking branch 'origin/master-next'
# Conflicts:
#	include/swift/Frontend/FrontendInputsAndOutputs.h
2020-06-08 16:43:40 -07:00
Dan Zheng
d3b6b89de6 [AutoDiff] Support multiple differentiability result indices in SIL. (#32206)
`DifferentiableFunctionInst` now stores result indices.
`SILAutoDiffIndices` now stores result indices instead of a source index.

`@differentiable` SIL function types may now have multiple differentiability
result indices and `@noDerivative` resutls.

`@differentiable` AST function types do not have `@noDerivative` results (yet),
so this functionality is not exposed to users.

Resolves TF-689 and TF-1256.

Infrastructural support for TF-983: supporting differentiation of `apply`
instructions with multiple active semantic results.
2020-06-05 16:25:17 -07:00
swift_jenkins
47c0e4c987 Merge remote-tracking branch 'origin/master' into master-next 2020-06-01 11:55:33 -07:00
Alexis Laferrière
8fefdece2c Use a SetVector when looking up the SPI attributes on imports
Using a SetVector fixes an issue where many source files imported the
same SPI group from the same module, the emitted private textual
interfaces superfluously repeated the `@_spi` attribute on the import.

rdar://problem/63681845
2020-05-27 16:11:12 -07:00
swift_jenkins
eeb085607c Merge remote-tracking branch 'origin/master' into master-next 2020-05-01 21:58:09 -07:00
Robert Widmann
72807bf284 [NFC] Don't Serialize Pattern::isImplicit 2020-05-01 16:30:00 -07:00