Commit Graph

39091 Commits

Author SHA1 Message Date
Pavel Yaskevich
20fc51d4f4 [CSBindings] Open collection before binding parameter only if original argument type failed
Instead of always opening argument type represented by a collection
without type variables (to support subtyping when element is a labeled tuple),
let's try original type first and if that fails use a slower path with
indirection which attempts `array upcast`. Doing it this way helps to
propagate contextual information faster which fixes a performance regression.

Resolves: rdar://problem/54580247
2020-02-27 16:26:13 -08:00
Doug Gregor
30e8d1791e [Constraint system] Handle implicit "some" patterns implicitly, better.
We have two similar code paths here that should probably be unified. For
now, make sure the more-specific one for pattern matching kicks in first.

Fixes rdar://problem/59838566.
2020-02-27 16:25:02 -08:00
Kuba Mracek
1bd425da67 [arm64e] Test changes to support arm64e 2020-02-27 16:10:48 -08:00
Daniel Duan
62e0da9913 [Property wrappers] Modernize self enclosing test (#30103)
The init parameter name changed to `wrappedValue` as of Swift 5.2.
2020-02-27 16:05:36 -08:00
AG
93d700001a Merge pull request #29874 from bitjammer/acgarland/rdar-58339492-sg-source-locations
SymbolGraph: Serialize source locations and doc comment ranges
2020-02-27 15:35:57 -08:00
Suyash Srijan
a5241edae9 [MiscDiagnostics] Suppress KVO warning when the property has an explicit setter (#30098) 2020-02-27 22:41:50 +00:00
Arnold Schwaighofer
5af921a7cc Merge pull request #30081 from aschwaighofer/irgen_fix_test_class_isa_pointers_armv7k_watchos
Fix irgen test class_isa_pointers_armv7k_watchos.sil
2020-02-27 14:31:02 -08:00
Slava Pestov
019452f9af Sema: Diagnose unbound method references on 'super.'
This is something I noticed by inspection while working on
<https://bugs.swift.org/browse/SR-75>.

Inside a static method, 'self' is a metatype value, so
'self.instanceMethod' produces an unbound reference of type
(Self) -> (Args...) -> Results.

You might guess that 'super.instanceMethod' can similarly
be used to produce an unbound method reference that calls
the superclass method given any 'self' value, but unfortunately
it doesn't work.

Instead, 'super.instanceMethod' would produce the same
result as 'self.instanceMethod'. Maybe we can implement this
later, but for now, let's just diagnose the problem.

Note that partially-applied method references with 'super.'
-- namely, 'self.staticMethod' inside a static context, or
'self.instanceMethod' inside an instance context, continue
to work as before.

They have the type (Args...) -> Result; since the self value
has already been applied we don't hit the representational
issue.
2020-02-27 17:28:23 -05:00
3405691582
0d3b92dfb1 Swift Basic/Driver recognizes OpenBSD.
Add the platform conditional and set up other basics for the toolchain.

The ConditionalCompilation tests are updated to match, since otherwise
they seem to trip when building on non-OpenBSD platforms. The
Driver/linker test is updated to ensure lld is passed on this platform.
Note that OpenBSD calls "x86_64" as "amd64", so we use that name for the
architecture instead of trying to alias one to the other, as this makes
things simpler.
2020-02-27 17:14:22 -05:00
Arnold Schwaighofer
869e579477 Merge pull request #30076 from aschwaighofer/silgen_fix_dynamic_replacement_before_original
SILGen: Fix dynamic replacement before original function
2020-02-27 12:03:09 -08:00
Nathan Hawes
242e0bb381 Merge pull request #30102 from nathawes/disable-failing-api-digester-test
[test] Disable test/api-digester/stability-stdlib-abi-without-asserts.swift
2020-02-27 11:53:15 -08:00
Nathan Hawes
71e21c476c [test] Disable test/api-digester/stability-stdlib-abi-without-asserts.swift
It's failing CI at the moment:
https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RD_test-simulator/2871

rdar://problem/59812778
2020-02-27 11:50:55 -08:00
Holly Borla
5ce5096633 [Test] Add more tests for @_typeEraser 2020-02-27 11:42:15 -08:00
Holly Borla
3cdc30ffeb [Sema] Support type erasure for dynamic replacement in function
builders.
2020-02-27 09:01:16 -08:00
Owen Voorhees
78b6759ba4 Merge pull request #30059 from owenv/sourcekit-edu-notes
[Diagnostics][SourceKit] Expose educational notes through SourceKit diagnostics request
2020-02-27 08:12:35 -08:00
eeckstein
7b2c8f1c87 Merge pull request #30074 from eeckstein/globalopt
GlobalOpt: improvements for constant folding global variables
2020-02-27 08:30:12 +01:00
Pavel Yaskevich
65ab041805 Merge pull request #29868 from omochi/fix-claimNextNamed
[ConstraintSystem] remove unused computation in claimNextNamed
2020-02-26 22:07:42 -08:00
Brent Royal-Gordon
222c459fb2 [SE-0274] Stage in #filePath (#29944)
* Stage in #filePath

To give users of #file time to transition, we are first adding #filePath without changing #file’s behavior. This commit makes that change.

Fixes <rdar://problem/58586626>.

* Correct swiftinterface test line
2020-02-27 00:03:13 -06:00
Argyrios Kyrtzidis
b6cafa119c Merge pull request #30090 from akyrtzi/turn-on-fast-completion
[SourceKit] Turn-on by default the fast completion mode
2020-02-26 20:01:21 -08:00
Argyrios Kyrtzidis
4d337f2db2 [SourceKit] Turn-on by default the fast completion mode
rdar://59830963
2020-02-26 18:16:07 -08:00
omochimetaru
79a8a596e4 [ConstraintSystem] remove unused computation in claimNextNamed 2020-02-27 10:49:42 +09:00
Joe Groff
7ac3338384 Merge pull request #30058 from jckarter/dont-cache-fixed-class-metadata
IRGen: Don't cache accesses to fixed class metadata.
2020-02-26 17:21:44 -08:00
swift-ci
b80b21b656 Merge pull request #30079 from varungandhi-apple/vg-selectively-disable-cross-import-test 2020-02-26 15:13:01 -08:00
Joe Groff
808d33d016 IRGen: Don't cache accesses to fixed class metadata.
The only initialization these class objects need is ObjC realization, which can be done
fast with `objc_opt_self` on recent Apple OSes. The cache check just adds code size and
dirties memory.
2020-02-26 15:10:18 -08:00
Rintaro Ishizaki
c3c5fbc5a2 Merge pull request #30004 from rintaro/ide-completion-genericreq-rdar58580482
[CodeCompletion] Re-implement generic requirement completion
2020-02-26 14:53:00 -08:00
Owen Voorhees
f11df3ee22 [Diagnostics][SourceKit] Expose diagnostic educational notes through SourceKit requests 2020-02-26 14:30:28 -08:00
Arnold Schwaighofer
0c764cb22c Fix irgen test class_isa_pointers_armv7k_watchos.sil
rdar://59818970
2020-02-26 13:46:37 -08:00
Varun Gandhi
3626f19e76 [NFC] Mark CrossImport test unsupported without assertions. 2020-02-26 13:22:46 -08:00
Joe Groff
0fb4ea1ec3 Merge pull request #30003 from NobodyNada/master
[SILOptimizer] Generalize optimization of static key paths, take 2
2020-02-26 12:13:43 -08:00
Suyash Srijan
d7bba7f193 [Typechecker] Use getCalledValue() rather than using DeclRefExpr to get the function decl when checking ignored expressions (#30077) 2020-02-26 19:49:58 +00:00
Rintaro Ishizaki
fc28f909b8 [CodeCompletion] Tweak canBeUsedAsRequirementFirstType() 2020-02-26 10:58:01 -08:00
Doug Gregor
031f5a4888 Merge pull request #30065 from DougGregor/function-builders-if-case-fixes
[Constraint system] Cleanups for function builders support for if let/if case let
2020-02-26 10:38:15 -08:00
Pavel Yaskevich
e70ef60ad5 Merge pull request #30067 from xedin/rdar-59741308
[ConstraintSystem] Don't attempt bindings for closure parameters/resu…
2020-02-26 10:03:58 -08:00
Rintaro Ishizaki
0dd0092e9e [CodeCompletion] Only suggest generic params in where for non-protocol
nominal types
2020-02-26 09:57:18 -08:00
Rintaro Ishizaki
ea6886114a [CodeCompletion] Generalize generic requirement completion
Align completion logics for all 'where' clauses.
2020-02-26 09:57:18 -08:00
Rintaro Ishizaki
75c36615e4 Merge pull request #29048 from rintaro/ide-completion-fasttoplevel-rdar58378157
[CodeCompletion] Fast completion for top-level code in single file script
2020-02-26 09:49:18 -08:00
Arnold Schwaighofer
cae695e81b SILGen: Fix dynamic replacement before original function
Creating a @_dynamicReplacement function requires the creation of a
reference to the original function. We need to call SILGenModule's
getFunction to satisfy all the assertions in place.

rdar://59774606
2020-02-26 09:47:36 -08:00
Erik Eckstein
43e8b07e3f GlobalOpt: improvements for constant folding global variables
* Simplified the logic for creating static initializers and constant folding for global variables: instead of creating a getter function, directly inline the constant value into the use-sites.
* Wired up the constant folder in GlobalOpt, so that a chains for global variables can be propagated, e.g.

  let a = 1
  let b = a + 10
  let c = b + 5

* Fixed a problem where we didn't create a static initializer if a global is not used in the same module. E.g. a public let variable.
* Simplified the code in general.

rdar://problem/31515927
2020-02-26 17:35:05 +01:00
Arnold Schwaighofer
c1edc2c31c Merge pull request #30050 from aschwaighofer/irgen_enable_type_layout_based_value_witnesses
IRGen: Enable TypeLayout based value witness generation
2020-02-26 06:59:10 -08:00
Michael Gottesman
54e2d97bca [temp-rvalue-opt] Update temp-rvalue-opt for OSSA.
The pass is already setup for OSSA, so I just enabled it for ownership and
converted its tests over. Eventually, I am going to be able to add support for
eliminating alloc_stack that have a loadabel value and whose lifetime are ended
via a load [take]. But that will be in a forthcoming commit.
2020-02-25 23:29:37 -08:00
Holly Borla
96d7434fd0 [Sema] Implement type erasure for dynamic replacement when the
dynamically replaceable function returns an opaque type.
2020-02-25 19:53:25 -08:00
swift-ci
281da6b451 Merge pull request #30066 from gottesmm/pr-1130ca3a3a3a8cf94b05b9bb79cdecefe4a48833 2020-02-25 19:42:32 -08:00
Michael Gottesman
48939898f6 Merge pull request #30064 from gottesmm/pr-f768cd12b2b9ed81d02c7df2f86e47aa07ef8cbe
[stdlib] Mark Unmanaged._withUnsafeGuaranteedRef as _transparent and add a test/comments as requested in the original PR where this landed.
2020-02-25 19:32:26 -08:00
Slava Pestov
d823be96a2 Merge pull request #30061 from slavapestov/property-wrapper-backing-init-constrained-extension
SILGen: Fix substitution map when calling property wrapper backing initializer
2020-02-25 22:11:45 -05:00
Slava Pestov
2ca7134f7d Merge pull request #30053 from slavapestov/keypath-component-resilient-stored-generic
SILGen: Work around for stored property keypath components not supporting generic resilient classes
2020-02-25 22:10:51 -05:00
Slava Pestov
2cfc2fa567 Merge pull request #30054 from slavapestov/vtable-thunk-generic-subclass-non-generic-base-class
Fix vtable thunk emission with a generic subclass of a non-generic base class
2020-02-25 22:10:03 -05:00
Ravi Kandhadai
482c82cee5 Merge pull request #30060 from ravikandhadai/oslog-dynamic-precision
[os log][stdlib/private] Enable precision and alignment values to be dynamic.
2020-02-25 19:08:19 -08:00
Pavel Yaskevich
0e88bd6890 [ConstraintSystem] Don't attempt bindings for closure parameters/result until body is opened
Let's delay attempting any bindings for type variables representing
parameters or result type of the closure until the body is "opened"
because it's impossible to infer a full set of bindings until all
constraints related to a closure have been generated.

Resolves: rdar://problem/59741308
2020-02-25 17:42:37 -08:00
Michael Gottesman
258f9bed8e [semantic-arc] Update begin_borrow elimination for guaranteed phi args.
Now, guaranteed phi args can also consume begin_borrow. This means our simple
analysis here is not sufficient. I am going to add support for this in a
forthcoming commit.

Optimizations are still not creating guaranteed phi arguments, so no breakage
can result.
2020-02-25 17:16:54 -08:00
Pavel Yaskevich
9ae68133ff Merge pull request #30040 from xedin/sr-11743
[ConstraintSystem] Look through l-value while checking whether dynami…
2020-02-25 17:09:45 -08:00