Commit Graph

16608 Commits

Author SHA1 Message Date
swift-ci
430744b2f3 Merge remote-tracking branch 'origin/master' into master-next 2018-04-06 12:12:17 -07:00
Slava Pestov
b4e145dc34 SE-0193: @inlinable implies @usableFromInline 2018-04-06 00:02:29 -07:00
Slava Pestov
618cbca27d Sema: Rename some 'versioned' diagnostics 2018-04-06 00:02:29 -07:00
swift-ci
2fda5ce1f5 Merge remote-tracking branch 'origin/master' into master-next 2018-04-05 22:53:22 -07:00
Doug Gregor
703f8dbb75 Merge pull request #15759 from ikesyo/sil-using-over-typedef
[gardening][SIL] Replace `typedef` with `using`
2018-04-05 22:42:49 -07:00
swift-ci
3d96bd77d1 Merge remote-tracking branch 'origin/master' into master-next 2018-04-05 19:49:57 -07:00
Slava Pestov
a4b91d252d Merge pull request #15666 from slavapestov/se-0193-default-args
SE-0193: Public default argument generators cannot reference declarations that are @usableFromInline
2018-04-05 19:46:20 -07:00
swift-ci
c991563cad Merge remote-tracking branch 'origin/master' into master-next 2018-04-05 18:51:37 -07:00
swift-ci
5e74cdabd7 Merge pull request #15773 from vedantk/cov-decls 2018-04-05 18:42:40 -07:00
Slava Pestov
96901f1983 SE-0193: Public default argument generators cannot reference declarations that are @usableFromInline 2018-04-05 16:56:34 -07:00
swift-ci
1a918cd7bd Merge remote-tracking branch 'origin/master' into master-next 2018-04-05 16:44:36 -07:00
Xi Ge
6067b65edb Merge pull request #15778 from nkcsgexi/digester-clean
swift-api-digester: minor refactoring. NFC
2018-04-05 16:40:28 -07:00
swift-ci
880857452c Merge remote-tracking branch 'origin/master' into master-next 2018-04-05 15:59:28 -07:00
Xi Ge
4705e0790c swift-api-digester: rename SDK nodes internally. NFC 2018-04-05 15:55:41 -07:00
Xi Ge
72f49e2351 swift-api-digester: separate internal and external names for node kinds. NFC 2018-04-05 15:38:17 -07:00
Slava Pestov
ff56a074af AST: Clean up the terminology around @usableFromInline in a couple of places 2018-04-05 14:31:32 -07:00
Vedant Kumar
daa094e5e0 [Coverage] Only instrument functions which are definitions
The ASTs for functions which aren't definitions may not be fully
typechecked or well-formed, so: avoid looking at them.

This fixes at least one assertion failure seen while building a project
with coverage, and is probably good for some substantial compile-time
improvements with coverage enabled.

rdar://39069115
2018-04-05 13:33:43 -07:00
swift-ci
8f0f89053a Merge remote-tracking branch 'origin/master' into master-next 2018-04-05 09:29:49 -07:00
Joe Groff
9793439356 Merge pull request #15722 from jckarter/deserialize-clang-importer-witness-tables-iii
SIL: Force Clang-imported protocol conformances to get deserialized when used.
2018-04-05 09:20:46 -07:00
Sho Ikeda
03fbd4a6de [gardening][SIL] Replace typedef with using 2018-04-05 13:53:20 +09:00
swift-ci
c5bb957ca6 Merge remote-tracking branch 'origin/master' into master-next 2018-04-04 21:49:28 -07:00
Huon Wilson
10dc220df6 Merge pull request #15751 from huonw/cond-conf-fixits
Fix & improve the fixits for conditional conformances.
2018-04-05 14:48:09 +10:00
swift-ci
860ee081e0 Merge remote-tracking branch 'origin/master' into master-next 2018-04-04 19:26:57 -07:00
swift-ci
22e91fd235 Merge pull request #15749 from graydon/batch-mode-flag-double-vision 2018-04-04 19:15:57 -07:00
Huon Wilson
ae1b06b041 [Sema] Display simplified conditional conformance fixits on the command line.
Fixes rdar://problem/39170601 and SR-7352.
2018-04-05 11:41:53 +10:00
Graydon Hoare
a9916dfd23 [BatchMode] Address review comments. 2018-04-04 16:29:02 -07:00
swift-ci
55aadf1ec8 Merge remote-tracking branch 'origin/master' into master-next 2018-04-04 16:27:36 -07:00
Huon Wilson
0736f5e50a Merge pull request #15736 from huonw/temporary-existential-layout
[AST] Avoid getProtocols on a temporary ExistentialLayout now and forever.
2018-04-05 09:12:35 +10:00
Graydon Hoare
0b4e7db476 [BatchMode] Consolidate reasoning about -{enable,disable}-batch-mode flag.
Previous to this change, the initial inspection of the -{enable,disable}-batch-mode
flag was made separate from the subsequent overriding by -wmo; this in turn meant
that the driver might decide it's "in batch mode" in one place (in particular,
when judging whether to ignore the -num-threads flag) and "in wmo mode" elsewhere
(when judging whether to emit one or multiple outputs, which depends on the
-num-threads flag).

Divergence between these two views caused the driver to effectively drop
the -num-threads flag even when overriding batch mode with wmo; since xcode
assumes that passing -wmo -num-threads _will_ cause multiple outputs, this
in turn caused linking to fail since the expected output files were not found.
2018-04-04 15:21:12 -07:00
Joe Groff
c5abef647f SIL: Force Clang-imported protocol conformances to get deserialized when used.
Code may end up indirectly using a witness table for a Clang-imported type by inlining code that used the conformance from another module, in which case we need to ensure we have a local definition at hand in the inlining module so we can have something to link against independently. This needs to be fixed from both sides:

- During serialization, serialize not only witness tables from the current module, but from Clang-imported modules too
- During deserialization, when the SILLinker walks a loaded module, ensure that all shared conformances get deserialized, including those from ApplyInsts and inherited/associated type protocol requirements.

Fixes rdar://problem/38687726.
2018-04-04 14:41:13 -07:00
swift-ci
5f6e75653e Merge remote-tracking branch 'origin/master' into master-next 2018-04-04 03:49:54 -07:00
Sho Ikeda
4ba2303163 Merge pull request #15706 from ikesyo/sema-using-over-typedef
[gardening][Sema] Replace `typedef` with `using`
2018-04-04 19:34:13 +09:00
Huon Wilson
ef8d71b01e [AST] Avoid getProtocols on a temporary ExistentialLayout now and forever.
Also, make ExistentialLayout non-self-referential, by moving that logic to the
point where it is used. The construction of the one-element-ArrayRef is so cheap
that it doesn't need to be cached.
2018-04-04 19:40:38 +10:00
swift-ci
df70a77b65 Merge remote-tracking branch 'origin/master' into master-next 2018-04-04 00:29:13 -07:00
Pavel Yaskevich
40a7416d23 Merge pull request #15620 from xedin/rdar-36560486-field-vector
[IRGen] Adjust element size of offset vector to 32-bit for structs
2018-04-04 00:22:47 -07:00
swift-ci
e2331de1d4 Merge remote-tracking branch 'origin/master' into master-next 2018-04-03 23:52:24 -07:00
Huon Wilson
306e8780fb Merge pull request #15268 from huonw/dont-infer-conditional
Make ConformanceLookupTable less recursive and don't imply conformances from conditional ones
2018-04-04 16:45:42 +10:00
swift-ci
8ff573b5ba Merge remote-tracking branch 'origin/master' into master-next 2018-04-03 19:41:16 -07:00
Slava Pestov
28d24f8f38 SIL: Remove redundant utility method and rename another one 2018-04-03 18:14:40 -07:00
Huon Wilson
c1044529ff [AST] Don't allow conditional conformances to imply others.
Many uses of conditional conformance to protocols with super-protocols
are for wrappers, where the conformances to those super-protocols
usually ends up using weaker bounds, such as:

  struct MyWrapper<Wrapped: Sequence> {}
  extension Wrapped: Sequence {} // Wrapped: Sequence
  extension Wrapped: Collection where Wrapped: Collection {} // *
  extension Wrapped: BidirectionalCollection where Wrapped: BidirectionalCollection {}

If this code was instead written:

  struct MyWrapper<Wrapped: Sequence> {}
  extension Wrapped: Sequence {} // Wrapped: Sequence
  extension Wrapped: BidirectionalCollection where Wrapped: BidirectionalCollection {}

Inferring a Collection conformance would have to mean

  extension Wrapped: Collection where Wrapped: BidirectionalCollection {}

which is unnecessarily strong.

It is a breaking change to change a protocol bound, and so we're
thinking we'd prefer that the compiler didn't magic up that incorrect
conformance. It also only is a small change (and the compiler even
suggests it, with a fixit) to explicitly get the implying behaviour:
declare the conformance explicitly.

  extension Wrapped: Collection, BidirectionalCollection where Wrapped: BidirectionalCollection {}

Fixes rdar://problem/36499373.
2018-04-04 10:34:33 +10:00
Huon Wilson
00c32698e2 [Parse] Put indent-is-4-spaces assumption in one place.
This single location can, theoretically, be made more intelligent about
deducing indent from elsewhere and all the consumers will just work.
2018-04-04 10:34:33 +10:00
Huon Wilson
48a06be73d [AST] Implied conformances store which conformance implied them. 2018-04-04 10:34:33 +10:00
Huon Wilson
a23808f5d2 [AST] Introduce 'resolveExtensionForConformanceConstruction' for lazier conformance searching.
We need to be able to find which conformances need to be
declared/constructed without forcing extensions to be completely
validated. This is important for both SR-6569 and
rdar://problem/36499373. The former due to the source-level recursion,
and the latter because implied conformances weren't always
constructed (but are needed for good diagnostics).

They weren't always constructed because:

1. ConformanceLookupTable's updateLookupTable on an early stage (before
   implied conformances are found) triggers extension
   validation *before* constructing any conformances, but *after*
   updating the stage state
2. extension validation validates the conditional requirements
3. validating the conditional requirements requires setting up generic
   signatures
4. setting up generic signatures forces the types conformances and so
   ends up in updateLookupTable on the same nominal again, skipping over
   the earlier stages that are complete/in progress
5. we expand the conformances that are implied by all the conformances we
   know about... But we don't know any, because we haven't finished the
   first updateLookupTable.

This breaks the loop at step 2: we instead do the minimal work needed to
know what conformances an extension (might) declare, which is connect
the extension to a type, and then resolve the inherited TypeReprs to
Types.
2018-04-04 10:34:33 +10:00
swift-ci
12848e52dc Merge remote-tracking branch 'origin/master' into master-next 2018-04-03 17:05:46 -07:00
Rintaro Ishizaki
8e8884d7e2 Merge pull request #15536 from rintaro/driver-incremental-moduleonly2
[Driver] Use separated build record file for '-emit-module' only mode
2018-04-04 08:55:30 +09:00
swift-ci
f2fbef8b03 Merge remote-tracking branch 'origin/master' into master-next 2018-04-03 16:19:14 -07:00
Slava Pestov
46d416361e Sema: Remove TypoCorrectionResolver
With the previous changes, validating a property while
type checking its initializer is no longer a fatal error.

This means we don't have to do anything special when
validating typo correction candidates, so we can get rid
of the TypoCorrectionResolver. This means there is now
only one subclass of LazyResolver, the TypeChecker itself.
2018-04-03 14:39:30 -07:00
Slava Pestov
09cc86011f Sema: Simplify recursion breaking for variables
We can use the existing logic for checking recursion in
declaration validation. This eliminates some bogus
diagnostics and allows some weird logic to be removed
from typo correction.
2018-04-03 14:39:30 -07:00
Pavel Yaskevich
78822bc23e [IRGen] Adjust element size of offset vector to 32-bit for structs
Type of elements contained by field offsets vector can be adjusted
to 32-bit integers (from being pointer sized) to safe space in the
binary since segment size is limited to 4 GB.

Resolves: rdar://problem/36560486
2018-04-03 13:32:06 -07:00
swift-ci
e65bed999f Merge remote-tracking branch 'origin/master' into master-next 2018-04-03 11:43:13 -07:00