Commit Graph

39091 Commits

Author SHA1 Message Date
Saleem Abdulrasool
42b3017224 build: duplicate _add_swift_library_single
This duplicates and renames the function `_add_swift_library_single`
into `_add_swift_host_library_single` and
`_add_swift_target_library_single`.  This will allow for splitting up of
the two paths from the functions.
2020-02-14 08:25:17 -08:00
Erik Eckstein
42971d9b61 add a test for an IRGen crash
This IRGen crash only shows up with this inliner change: https://github.com/apple/swift/pull/29784 (which is currently reverted)

rdar://problem/59456064
2020-02-14 16:51:18 +01:00
Erik Eckstein
92a764d9f6 Revert "Inliner: inline generic thunks which return a partial_apply."
This reverts commit 66474ed5a2.

The original commit triggers a crash in IRGen: rdar://problem/59456064
Reverting for now until the IRGen issue is fixed.
2020-02-14 13:48:04 +01:00
swift-ci
92f84f8191 Merge pull request #29835 from devincoughlin/isOSVersionAtLeast-no-inline-for-you 2020-02-13 22:04:19 -08:00
Devin Coughlin
664e7cc00e [Availability] Make _stdlib_isOSVersionAtLeast() no longer inlinable
To make it possible to change the implementation of
_stdlib_isOSVersionAtLeast(), remove the @inlinable attribute from it.

Since it is currently inlinable and calls the helper function
_swift_stdlib_operatingSystemVersion(), we’ll have to keep the
helper around as ABI.

This change causes a minor pessimization where the LLVM optimizer can no
longer reason that, for example, a successful check for 10.12 availability
means that a later check for 10.11 will always succeed. I don't expect this
pessimization to be a problem, but if needed we could write a custom SIL
optimizer pass to claw back the performance.

<rdar://problem/59447474>
2020-02-13 20:08:48 -08:00
Robert Widmann
1f867edfd4 Merge pull request #29833 from CodaFi/do-the-cupid-shuffle
[Sema] Warn About Tuple Shuffles
2020-02-13 19:33:55 -08:00
Robert Widmann
04d47dc621 Merge pull request #29831 from CodaFi/protocol-dictates-action
[ClangImporter] Commit a regression test for protocols via nested names
2020-02-13 19:33:19 -08:00
Slava Pestov
84ec27cc81 Merge pull request #29826 from slavapestov/assign-to-self-static-property-wrapper
SILGen: Fix crash on assignment to static property wrapper through 'self'
2020-02-13 21:14:44 -05:00
Varun Gandhi
d58bf546be [Diagnostics] Improve diagnostics for implicit (un)tupling. (#28076)
Fixes rdar://problem/56436226.
2020-02-13 17:38:21 -08:00
Robert Widmann
a9e871a0b1 [Sema] Warn About Tuple Shuffles
Emit a warning that tuple shuffling is deprecated across the board. In
the future, we should try to unshuffle these expressions where we can,
but that's a diagnostic improvement for another day.

See also https://forums.swift.org/t/deprecating-tuple-shuffles-round-2/16884/30
2020-02-13 17:29:03 -08:00
Dan Zheng
a49428ca7c [AutoDiff upstream] Add differentiability_witness_function instruction. (#29765)
The `differentiability_witness_function` instruction looks up a
differentiability witness function (JVP, VJP, or transpose) for a referenced
function via SIL differentiability witnesses.

Add round-trip parsing/serialization and IRGen tests.

Notes:
- Differentiability witnesses for linear functions require more support.
  `differentiability_witness_function [transpose]` instructions do not yet
  have IRGen.
- Nothing currently generates `differentiability_witness_function` instructions.
  The differentiation transform does, but it hasn't been upstreamed yet.

Resolves TF-1141.
2020-02-13 16:55:46 -08:00
Robert Widmann
a72c5faac7 [ClangImporter] Commit a regression test for protocols via nested names
It's a terrible idea to support this in the long run, but in the short
term we should at least know what the compiler does in these situations.

Relates to rdar://59431058
2020-02-13 16:41:10 -08:00
Slava Pestov
38815ecf8d SILGen: Fix crash on assignment to static property wrapper through 'self'
Fixes <rdar://problem/59117087>.
2020-02-13 18:18:23 -05:00
Rintaro Ishizaki
bfa385c0b7 [CodeCompletion] Update for SE-0249 KeyPath as functions
If the context type is a function type that receives one argument, infer
the key path expressions root type from the context.

rdar://problem/59302416
2020-02-13 13:11:36 -08:00
Jonathan Keller
d7acf12158 [SILOptimizer] fix crash in key path projector
When a computed property returns a generic, the accessor's function
type may involve a type parameter that needs to be resolved using
the key path instruction's substitution map.
2020-02-13 12:53:07 -08:00
swift-ci
1d2d8d4aee Merge pull request #29811 from nate-chandler/reenable-test-for-59425215 2020-02-13 11:27:42 -08:00
Rintaro Ishizaki
63772d04a8 Merge pull request #29789 from rintaro/ide-completion-rdar58851121
[CodeCompletion] Enable fast-completion at the top of implicit getter
2020-02-13 10:34:57 -08:00
Nate Chandler
da3a393e64 Reenable temporarily disabled test.
The test relies on new runtime functionality that is by definition not
available in the stdlib in the OS.  Here, the test is marked as
unsupported run running using the OS' stdlib.

rdar://problem/59425215
2020-02-13 09:44:21 -08:00
nate-chandler
8c92cfd42c Temporarily disable Result_future.swift test. (#29809)
Reenabling the test is tracked by rdar://problem/59425215 .
2020-02-13 18:26:06 +01:00
Stephen Canon
0174f5dbd0 Mark Prototypes/Result_future.swift unsupported on tvOS simulator. (#29808) 2020-02-13 17:57:18 +01:00
Pavel Yaskevich
355148dbe8 Merge pull request #29746 from hborla/ambiguity-with-fixes
[Diagnostics] Refactor diagnoseAmbiguityWithFixes.
2020-02-13 02:42:43 -08:00
Pavel Yaskevich
60a210b657 [ConstraintSystem] NFC: Fix a couple of typos in comments 2020-02-13 00:44:20 -08:00
eeckstein
6853289545 Merge pull request #29784 from eeckstein/inline-generic-curry-thunks
Inliner: inline generic thunks which return a partial_apply.
2020-02-13 08:53:09 +01:00
Slava Pestov
aa417c306b Merge pull request #29793 from slavapestov/small-misc-cleanups
Small miscellaneous cleanups
2020-02-13 00:04:24 -05:00
Doug Gregor
08315b102d Merge pull request #29786 from DougGregor/function-builders-let-decls
Allow initialized let/var declarations in function builders.
2020-02-12 20:50:28 -08:00
swift-ci
ac71c7c875 Merge pull request #29802 from ravikandhadai/oslog-dynamic-string-formatting 2020-02-12 20:47:41 -08:00
Luciano Almeida
fd2dbe3135 [tests] Adding literal downcast tests 2020-02-13 01:04:15 -03:00
Daniel Rodríguez Troitiño
6c7cdef5bd Merge pull request #29787 from drodriguez/android-xfail-pic
[android][aarch64] XFAIL IRGen/pic.swift test.
2020-02-12 19:19:00 -08:00
Ravi Kandhadai
3c7f6d88e2 [stdlib/private][OSLog] Add basic support for interpolating floating-point
types without formatting options, add an auto-inferred privacy mode and
make it the default privacy mode, add support for aligning string
arguments.
2020-02-12 18:46:50 -08:00
Pavel Yaskevich
5437622d2d [Diagnostics] Diagnose ambiguity with conflicting arguments to generic parameters
It's done by first retrieving all generic parameters from each solution,
filtering boundings into distrinct set and diagnosing any differences.

For example:

```swift
func foo<T>(_: T, _: T) {}
func bar(x: Int, y: Float) {
  foo(x, y)
}
```
2020-02-12 17:53:31 -08:00
Doug Gregor
2347829324 [Constraint System] Allow initialized let/var declarations in function builders.
Introduce support for initialized let/var declarations within function
builder closures, e.g.,

    let (a, b) = c()

We generate constraints for the declarations as elsewhere, but the types of
the declared variables (a and b in this case) are bound to the type of the
pattern by one-way constraints, to describe the flow of type information
through the closure.

Implements rdar://problem/57330696.
2020-02-12 17:51:48 -08:00
Xi Ge
02f01703f9 Merge pull request #29783 from nkcsgexi/embed-symbols-tbd
TBDGen: add a flag for embedding external symbols in emitted tbd file
2020-02-12 17:39:14 -08:00
Holly Borla
8c1a95930b Merge pull request #29795 from vukrado/SR-11964-bad-diagnostic-mismatched-numeric-types
[CSSimplify] Increment impact for DefineMemberBasedOnUse when base type is any function type
2020-02-12 17:23:01 -08:00
swift-ci
c59f1aa6ba Merge pull request #29797 from CodaFi/clotheslined 2020-02-12 15:55:29 -08:00
Nathan Hawes
947c6c9074 Merge pull request #29769 from nathawes/fix-syntax-model-assertion-failures
[SourceKit] Fix SyntaxModel assertion failure due to consuming tokens twice or out of order
2020-02-12 15:44:05 -08:00
nate-chandler
e467514a9a Merge pull request #29791 from nate-chandler/irgen/add-argument-labels-to-remaining-tests
[IRGen] Adapt remaining tests to arguments in IR.
2020-02-12 15:36:59 -08:00
Slava Pestov
06855f758d AST: Remove a couple of redundant statistics 2020-02-12 18:29:27 -05:00
Slava Pestov
d47d5e9323 SILGen: Fix a formatting nit in a test 2020-02-12 18:29:27 -05:00
swift-ci
07c8b1b6ed Merge pull request #29796 from gottesmm/pr-2423e684c18a997168836ff45d573f1fb808ebd0 2020-02-12 15:27:35 -08:00
Robert Widmann
86d6e42c2a Merge pull request #29794 from CodaFi/crash-pad
Specialize a test for Windows
2020-02-12 14:42:00 -08:00
tbkka
74df8725ab SR-12161 Casting P.self to P.Type regressed in iOS13.4 beta (#29779)
* SR-12161 Casting P.self to P.Type regressed in iOS13.4 beta

An earlier fix for certain protocol casts inadvertently disabled
the check for a protocol being cast to its own metatype.
This rearranges the code so that identical types always succeed.
It also updates swift_dynamicCastMetatypeUnconditional to
include recent changes to swift_dynamicCastMetatype.

Note: These fixes only apply to debug/non-optimized builds.
Cast optimizations still break a lot of these cases.
2020-02-12 14:24:31 -08:00
Robert Widmann
e5d9fef296 Add a regression test for the @usableFromInline pattern in rdar://59171169
Make sure we don't print @_hasMissingDesignatedInitializers in the swift
interface when we actually can see all the designated initializers.
2020-02-12 14:13:52 -08:00
Xi Ge
e013f1fb81 TBDGen: add a flag for embedding external symbols in emitted tbd file
Static-linked libraries could add symbols to the final tbd file. We need
this flag to specify additional module names to collect symbols from.

rdar://59399684
2020-02-12 13:47:59 -08:00
Slava Pestov
f664be47f4 Merge pull request #29122 from zoecarver/optimize/global-var-init
Update global init optimization to work with vars
2020-02-12 16:47:48 -05:00
Nathan Hawes
5e1985c989 [SourceKit] Fix SyntaxModel assertion failures due to consuming tokens twice or prematurely
The SyntaxModel walker would end up visiting the attributes attached to a
PatternBindingDecl twice if it contained more than one VarDecl, hitting the
below assertion on the second visit because the tokens corresponding to the
attribute had already been consumed the first time around:
```
Assertion failed: (0 && "Attribute's TokenNodes already consumed?"), function
  handleSpecialDeclAttribute
```
It would also hit the same assertion for attributes on an EnumCaseDecl, but even
when it only had a single child EnumElementDecl.  This because when we visited
the EnumCaseDecl and pushed its structure node, we'd consume and emit any tokens
before it's start position. This meant that when we tried to process the
attributes attached to the child EnumElementDecl its tokens had already been
consumed, triggering the assertion.

In both cases the attributes syntactically attach to the parent
PatternBindingDecl or EnumCaseDecl, but in the AST they're accessed via their
child VarDecls or EnumElementDecls.

Resolves rdar://problem/53747546
2020-02-12 13:44:04 -08:00
Michael Gottesman
60a09dd63c [builtin] Change ConvertStrongToUnownedUnsafe and ConvertUnownedUnsafeToGuaranteed to take non-optional arguments. 2020-02-12 13:30:06 -08:00
nate-chandler
b62871047d Merge pull request #29345 from nate-chandler/generic-metadata-prespecialization-components/enums
Generic metadata prespecialization: enums
2020-02-12 13:09:59 -08:00
Vuk Radosavljevic
41e2411752 [CSSimplify] Increment impact by 1 for DefineMemberBasedOnUse when base type is any function type 2020-02-12 14:49:19 -06:00
Robert Widmann
12d542c24f Specialize a test for Windows
An unfortunate workaround for rdar://59397376

Resolves rdar://59318361
2020-02-12 12:45:43 -08:00
Nate Chandler
de577b70cc [IRGen] Adapt remaining tests to arguments in IR. 2020-02-12 10:50:14 -08:00