Commit Graph

39091 Commits

Author SHA1 Message Date
Rintaro Ishizaki
ff2ccd485c [CodeCompletion] Workaround fast-completion issue in UnqualifiedLookup
In fast-completion, a function body can be replaced with another function
body parsed from a new buffer. In such cases, during typechecking the
expressions in the *new* function body, a source location range check in
UnqualifiedLookup didn't work well because they are not from the same
buffer.

This patch workaround it by skipping the source range checks and returns
'success' in such cases.

rdar://problem/58881999
2020-02-12 10:41:43 -08:00
Rintaro Ishizaki
7b4db904a1 [CodeCompletion] Complete at the top of accessor block in body parsing
If a CC token is right after the '{' we still don't know it's an implicit
getter or a start of a accessor block. Previously, the parser used to
parse it as an accessor block, but it prevents fast-completion kicks in.

Instead handle it as a part of function body parsing so the
fast-completion works.

rdar://problem/58851121
2020-02-12 10:19:18 -08:00
Nate Chandler
40e17d9c6f [metadata prespecialization] Direct refs to enums.
When a specialized usage of a generic enum occurs in the same module
where the enum was defined, directly reference the prespecialized
metadata.

rdar://problem/56994321
2020-02-12 10:08:33 -08:00
Daniel Rodríguez Troitiño
d474b46401 [android][aarch64] XFAIL IRGen/pic.swift test.
The codegen for Android AArch64 differs in order to the expected one
(and the one that seems to happen in Linux AArch64). The SIL and IR are
the same, but the final codegen is different.

More details in https://bugs.swift.org/browse/SR-12194.

This was introduced with the master rebranch of February 10th 2020.
2020-02-12 10:08:10 -08:00
Holly Borla
24826e01bd Merge pull request #29775 from hborla/parse-type-eraser-attribute
[Parse] Add an attribute for typeEraser.
2020-02-12 09:58:14 -08:00
Arnold Schwaighofer
90d942ca26 Merge pull request #29740 from aschwaighofer/irgen_cache_optional_metadata_construction
IRGen: Cache type metadata construction of Optional types
2020-02-12 08:28:29 -08:00
Erik Eckstein
66474ed5a2 Inliner: inline generic thunks which return a partial_apply.
The returned partial_apply of a thunk is most likely being optimized away if inlined.
Because some thunks cannot be specialized (e.g. if an opened existential is in the subsitution list), inline such thunks also in case they are generic.

https://bugs.swift.org/browse/SR-12115
rdar://problem/59061452
2020-02-12 09:36:12 +01:00
Slava Pestov
8d1eb7a066 Merge pull request #29753 from slavapestov/got-entry-cleanup
IRGen GOT entry cleanup
2020-02-12 00:52:49 -05:00
Holly Borla
ffba71b889 [Parse] Add an attribute for typeEraser.
This will be used for compiler-driven type erasure for dynamic
replacement of functions with an opaque return type. For now, just
parse the attribute and ignore it.
2020-02-11 17:30:21 -08:00
Argyrios Kyrtzidis
881ceed711 Merge pull request #29773 from akyrtzi/structure-walk-closure-var-once
[IDE/SyntaxModel] For syntactic structure, make sure to not visit the captured list variables twice
2020-02-11 17:24:14 -08:00
Doug Gregor
151fc79264 Merge pull request #29770 from DougGregor/builder-transform-node-types
[Constraint solver] Fix handling of node types for function builder application
2020-02-11 17:21:16 -08:00
swift-ci
0dc9c02d07 Merge pull request #29772 from DougGregor/disable-one-dependency-file 2020-02-11 17:20:54 -08:00
AG
53f494cba2 Merge pull request #29708 from bitjammer/acgarland/rdar-58941718-separate-sgf-extended-modules
Separate symbol graph files for extended modules
2020-02-11 16:38:03 -08:00
Slava Pestov
e6dc10accd IRGen: More accurate getAddrOfLLVMVariableOrGOTEquivalent()
The logic here used to consist of a couple of ad-hoc checks,
followed by a general assumption that if something had already
been emitted, it could be referenced directly, whereas everything
else had to go through a GOT entry.

This is way too conservative. Instead, let's try to correctly
calculate what translation unit an entity is going to end up in.
2020-02-11 18:59:21 -05:00
Slava Pestov
204fce6b10 IRGen: CHECK => CHECK-SAME 2020-02-11 18:59:21 -05:00
Argyrios Kyrtzidis
73c3e1c693 [IDE/SyntaxModel] For syntactic structure, make sure to not visit the captured list variables twice
rdar://59302427
2020-02-11 15:37:22 -08:00
Doug Gregor
d000065ab1 Revert "Change to defaulting on"
This reverts commit b1f6a8941c. This
change is causing some instability with incremental builds, so we're
backing it out. Fixes rdar://problem/59016969.
2020-02-11 15:34:48 -08:00
Doug Gregor
4c98b31031 [Constraint solver] Apply solution to the system before builder transform.
This makes sure we can find information in the constraint system during
application. Fixes rdar://problem/59239224
2020-02-11 15:14:44 -08:00
Nathan Hawes
6640316b82 Merge pull request #29596 from Regno/feature/vlasov/SR-5740
[Source Tooling] Refactoring action to convert if statement to switch
2020-02-11 15:02:25 -08:00
Holly Borla
d1f6b3e2ef [Diagnostics] When diagnosing an ambiguous overload, don't mention "call"
if the expression is not a function application.
2020-02-11 14:53:27 -08:00
Holly Borla
1a628f3107 [Diagnostics] Simplify logic in diagnoseAmbiguityWithFixes for emitting
the ambiguity diagnostic by combining a few special errors into one.
2020-02-11 14:53:27 -08:00
Holly Borla
651c27b50b [Diagnostics] Add CSFix::diagnoseForAmbiguity for diagnosing common
fixes that appear in all solutions.
2020-02-11 14:53:27 -08:00
Holly Borla
54706ba79b [Diagnostics] Simplify diagnoseAmbiguityWithFixes by removing AmbiguityKind. 2020-02-11 14:53:27 -08:00
Holly Borla
607c298493 [Diagnostics] Refactor diagnoseAmbigutiyWithFixes to use the differences between
solutions in order to figure out the source of ambiguity.
2020-02-11 14:52:41 -08:00
Mattt
d40d47f209 Fix spelling of '@available' in error message "'@availability' attribute cannot be applied to this declaration" (#29760)
* Update DAK_Available name to match @available keyword

Update expected errors for @available attribute tests

* Update available attribute keyword name in DeclAttrKeyword documentation comment
2020-02-11 22:45:38 +00:00
Robert Widmann
f4cef5715a Merge pull request #29742 from CodaFi/leaving-the-nest
Always write out nested types tables
2020-02-11 13:40:59 -08:00
Arnold Schwaighofer
ea5fa5afd3 IRGen: Cache type metadata construction of Optional types
To achieve this replace the current implementation which recursively
constructs a layout compatible metadata by an implementation that
recursively constructs a layout compatible type and the use
emitTypeMetadataRef on that type to generate the metadata.
2020-02-11 13:32:53 -08:00
Ashley Garland
58bbe1ec04 SymbolGraph: Don't unconditionally add edge targets to the graph
Edge targets might point outside the module, so don't include them
unconditionally.

rdar://58876107
2020-02-11 13:23:16 -08:00
Ashley Garland
7190073a85 Serialize symbol graphs for extended modules separately
When a module extends a type from another module, serialize those symbols into
separated files dedicated to those extended modules. This makes it easier to
ingest and categorize those symbols under the extended module if desired.

rdar://58941718
2020-02-11 13:23:16 -08:00
eeckstein
a4ba2cec27 Merge pull request #29761 from eeckstein/fix-optimizer-tests2
tests: remove -enforce-exclusivity=unchecked from another test.
2020-02-11 21:20:03 +01:00
Doug Gregor
44b5d6446c Merge pull request #29728 from DougGregor/sink-init-pattern-constraints
[Constraint solver] Sink down initialization pattern handling
2020-02-11 12:01:55 -08:00
swift-ci
518509dcf1 Merge pull request #29653 from owenv/test-fix 2020-02-11 09:43:53 -08:00
Erik Eckstein
8364a1faf6 tests: remove -enforce-exclusivity=unchecked from another test.
This is a follow-up on https://github.com/apple/swift/pull/29759
2020-02-11 17:58:47 +01:00
eeckstein
d4837c4a82 Merge pull request #29703 from eeckstein/fix-partial-apply-combine
SILOptimizer: restructure the apply(partial_apply) peephole and the dead partial_apply elimination optimizations
2020-02-11 17:54:41 +01:00
Erik Eckstein
9de45ac92e tests: remove -enforce-exclusivity=unchecked from tests which check the optimization result.
Tests which check if the optimizer is able to generate a certain code should never be "worked around" by adding command line options.
This defeats the purpose of such tests.
Unfortunately some optimizer deficiencies got unnoticed by adding this option.

to-do: there are more such cases which I didn't fix in this PR yet.
2020-02-11 14:21:22 +01:00
Erik Eckstein
85789367a3 SILOptimizer: restructure the apply(partial_apply) peephole and the dead partial_apply elimination optimizations
Changes:

* Allow optimizing partial_apply capturing opened existential: we didn't do this originally because it was complicated to insert the required alloc/dealloc_stack instructions at the right places. Now we have the StackNesting utility, which makes this easier.

* Support indirect-in parameters. Not super important, but why not? It's also easy to do with the StackNesting utility.

* Share code between dead closure elimination and the apply(partial_apply) optimization. It's a bit of refactoring and allowed to eliminate some code which is not used anymore.

* Fix an ownership problem: We inserted copies of partial_apply arguments _after_ the partial_apply (which consumes the arguments).

* When replacing an apply(partial_apply) -> apply and the partial_apply becomes dead, avoid inserting copies of the arguments twice.

These changes don't have any immediate effect on our current benchmarks, but will allow eliminating curry thunks for existentials.
2020-02-11 12:48:39 +01:00
Suyash Srijan
211394099f [CSDiagnostics] Offer a fix-it to insert a return type placeholder when returning from a void function (#29747)
* [CSDiagnostics] Offer a fix-it to insert a return type when returning from a void function

* [CSDiagnostics] Make sure the function name is not empty

The function name will be empty in some cases, for example for property setters. In cases where the function name is empty, skip the note and fix-it.

* [Test] Update existing diagnostics
2020-02-11 10:25:16 +00:00
Pavel Yaskevich
b3590c5f1d Merge pull request #29734 from LucianoPAlmeida/remove-diag-parameters-errors
[Diagnostics] Remove `FailureDiagnosis::diagnoseParameterErrors` from CSDiag
2020-02-11 01:32:31 -08:00
Slava Pestov
988e9d6d3e Merge pull request #29726 from slavapestov/fix-silgen-vtable-assertion
SILGen: Relax assertion about missing vtable entries in a class
2020-02-11 01:47:08 -05:00
Jonas Devlieghere
413b8d0523 Merge pull request #29750 from JDevlieghere/fix-linux-fatal-backtrace.swift
[test] Fix LLDB Python Path and re-enable linux-fatal-backtrace.swift
2020-02-10 22:20:25 -08:00
Doug Gregor
97aaa8a229 [Constraint solver] Make sure to reflect pattern updates after application. 2020-02-10 22:01:37 -08:00
Doug Gregor
c1c7112110 Remove some unused code and fix a test 2020-02-10 22:01:37 -08:00
Mishal Shah
db8bf0bd29 Merge pull request #29744 from apple/master-rebranch
Merge master-rebranch into master to support new llvm branch apple/stable/20200108
2020-02-10 17:50:40 -08:00
Slava Pestov
fc810e1205 SILGen: Relax assertion about missing vtable entries in a class
Since resilient class metadata is built at runtime, we don't actually
care if there are missing vtable entries. The restriction was relaxed
in Sema in 9117c5728a, but SILGen still
had an assertion here.

Add a test and relax the assertion.

Fixes <rdar://problem/58644615>.
2020-02-10 19:28:11 -05:00
Jonas Devlieghere
21327e79d9 [test] Fix LLDB Python Path and re-enable linux-fatal-backtrace.swift 2020-02-10 16:17:04 -08:00
Mishal Shah
7952f051a3 Disable linux-fatal-backtrace.swift (59328972) 2020-02-10 15:44:31 -08:00
Robert Widmann
6d40e7b350 XFAIL a test holding up the rebranch process 2020-02-10 11:24:15 -08:00
Robert Widmann
53b368b34f Always write out nested types tables
Remove the option to switch off nested types tables. In a world where
re-entrant direct lookup will cause deserialization to fail (or worse),
disabling these tables will only lead to further instability in the
compiler.
2020-02-10 10:41:23 -08:00
swift-ci
227485bf02 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-10 07:14:14 -08:00
Luciano Almeida
46092aff3e [tests] Adjusting tests under type/opaque 2020-02-10 07:48:34 -03:00