Commit Graph

7604 Commits

Author SHA1 Message Date
Pavel Yaskevich
863058757d [TypeChecker] NFC: Add test-case for rdar://112095973 2023-10-25 14:58:11 -07:00
Tim Kientzle
5d4c29cd09 Fix a bunch of reflection tests to be correct for Ubuntu
These tests had Darwin-specific code in them, mostly unnecessary,
that caused them to break on non-Darwin platforms.

Only one (reflect_Enum_SingleCaseCFPayload.swift) was actually
specific to Darwin.  That one has been disabled.  For the rest,
just delete the unnecessary `import Darwin` and similar.
2023-10-24 06:58:41 -07:00
Kavon Farvardin
0f2a8d5ea7 bump number of diags in 0161-issue-49119.swift
Seems we already emit 6 duplicate diagnostics for this test, so what's
one more?

I'm not sure what change I made triggered this additional diagnostic.
2023-10-18 20:02:17 -07:00
Pavel Yaskevich
23701bbb6d Merge pull request #69174 from xedin/rdar-116122902
[CSDiagnostics] Adjust how requirement failures anchor type is computed
2023-10-17 21:08:36 -07:00
Pavel Yaskevich
4c38d72230 [Tests] NFC: Add a FIXME about use of <<error type>> in a diagnostic 2023-10-16 12:37:54 -07:00
Erik Eckstein
54d254f100 Optimizer: better handling of the complexity budget in redundant-load-elimination and dead-store-elimination.
Instead of having a budget for each optimized load or store, provide a budget for the whole function.
Fixes a build time problem.

rdar://116877696
2023-10-16 14:44:34 +02:00
Pavel Yaskevich
a90bd1cbe1 [Tests] NFC: Add a test-case for rdar://116122902 2023-10-13 10:50:15 -07:00
Yuta Saito
e52b155a9c [test] Disable multithreading tests on threading_none 2023-10-11 18:14:43 +00:00
Yuta Saito
4c8dc5bcb8 [test] Replace obsolete single_threaded_runtime feature with threading_none
The feature was renamed in 0cf687aa2b but
validation tests were not updated at that time.
2023-10-11 18:14:43 +00:00
Tim Kientzle
8bb3a55702 [RemoteInspection] Allow enums to be trivial even with a formal payload
A "trivial" enum is one that carries no information.
The previous logic asserted that a trivial enum had only one
case and that case had no payload.
But this is also a trivial payload:
```
// Trivial, so zero-sized
enum MyFormatVersion {
  case v4
}
// Also trivial, since the payload carries no information
enum Format {
  case MyFormat(MyFormatVersion)
}
```

This commit adds a test case similar to the above
and corrects the assertions for trivial enums to
assert that there is either no payload, or that the
payload is zero-sized.

Resolves rdar://116406504
2023-10-03 14:06:12 -07:00
Kuba Mracek
884bd6e173 [embedded] Adjust verify_all_overlays.py to avoid checking Cxx and CxxStdlib 2023-09-26 23:02:14 -07:00
Anthony Latsis
2644adf2b0 [NFC] Delete redundant RUN line in test 2023-09-26 16:32:29 +03:00
Anthony Latsis
5e50aa5d08 [NFC] Add lit test for Xcode project generation 2023-09-26 16:32:27 +03:00
Tim Kientzle
06896074c5 Merge pull request #68634 from hjyamauchi/enum-multipayload-generic-empty
Account for the generic zero-sized payload enum cases.
2023-09-25 14:43:37 -07:00
Anthony Latsis
17fc2d200e build-script: Don't emit build commands for LLVM when --build-llvm set to false 2023-09-23 14:10:05 +03:00
Holly Borla
940ab81244 Merge pull request #68685 from hborla/minimize-constraint-system-isolation-checking 2023-09-22 07:31:45 -07:00
Holly Borla
2e9c64d36c [Concurrency] Do not allow actor isolation violations in function conversions
to impact constraint solving.
2023-09-21 19:44:03 -07:00
Hiroshi Yamauchi
ed58501ecd Account for the generic zero-sized payload enum cases.
Disable the assert:

    // At least one payload is non-empty (otherwise this                                                                                                                  // would get laid out as a non-payload enum)                                                                                                                          assert(getNumNonEmptyPayloadCases() > 0);

in TaggedMultiPayloadEnumTypeInfo because it fails when you have
generic but zero-sized payload enum cases.

Also remove unnecessary "REQUIRES: objc_interop" lines from the enum
reflection tests.
2023-09-21 09:31:24 -07:00
Alex Hoppen
9b31e9a69f Merge pull request #68595 from ahoppen/ahoppen/batch-completion
[tests] Add a `%batch-code-completion` lit substitution
2023-09-20 17:26:09 -07:00
Erik Eckstein
09b443d9e3 IRGen: fix emission of constant single-case enums without payload
This is a follow-up of https://github.com/apple/swift/pull/68516 which didn't handle the no-payload case correctly

Fixes a compiler crash

rdar://115666971
2023-09-19 10:28:51 +02:00
Alex Hoppen
a5a17aa955 [tests] Add a %batch-code-completion lit substitution
I could never remember the command to run batch code completion tests. Add a lit substitution for it.
2023-09-18 13:57:49 -07:00
Erik Eckstein
9cf0229824 IRGen: fix emission of constant single-case enums
Enums which have a single case with a payload were emitted with wrong field alignement into the data section.

Fixes a miscompile:
rdar://115251963
2023-09-14 12:17:06 +02:00
Hamish Knight
97c3275f6b Add missing %target-codesigns to a couple of tests 2023-09-12 14:45:51 +01:00
Erik Eckstein
885f267362 tests: increase timeout of large_nested_array test
It fails on some jobs intermittently

rdar://115165160
2023-09-11 12:08:47 +02:00
Nate Chandler
d239a14f12 [Test] Required executable_test in executing test.
rdar://115169839
2023-09-08 07:08:59 -07:00
nate-chandler
57e56a0a9e Merge pull request #68342 from nate-chandler/gh68328
[MoveChecker] Complete lifetimes before checking.
2023-09-07 12:20:09 -07:00
Nate Chandler
7713eef817 [MoveValueChecker] Complete lifetimes first.
Before move-checking values, complete the lifetimes of all the values
derived from them via copy, borrow, and move.

Collect all such values and their derived transitive values and then
complete the lifetimes of each, visiting the instructions which produce
them in post-order.

Once OSSALifetimeCommpletion runs as part of SILGenCleanup, this code
can be deleted.
2023-09-07 07:11:24 -07:00
Alex Hoppen
acc6c10344 Merge pull request #68075 from ahoppen/ahoppen/labeled-trailing-closure-solver-based
[CodeCompletion] Migrate labeled trailing closure completions to solver-based
2023-09-06 13:10:56 -07:00
Erik Eckstein
f6f9e75173 AliasAnalysis: use a complexity limit for the isObjReleased function
We already use a complexity limit for other functions in AliasAnalysis.
This is a workaround for quadratic complexity in ARCSequenceOpts.

Fixes a compile time problem
rdar://114352817
2023-09-04 19:52:57 +02:00
Nate Chandler
b3e009003f [Test] Loosened check lines.
The metatype param may or may not be removed from the callee during
specialization.  If it is, there is only one argument, if it is not,
there are two arguments.  None of that is relevant to this test case.
It is just verifying that the strong_retain occurs before the apply.
2023-08-31 15:19:57 -07:00
Ben Barham
d431e03307 Merge pull request #68218 from bnbarham/set-python-encoding
[stdlib] Set PYTHONIOENCODING when building the stdlib
2023-08-31 09:46:10 -07:00
Nate Chandler
504ce43753 [stdlib] Delete bad @_effects(readonly) annotation
`Dictionary.init(dictionaryLiteral:)` was annotated
`@_effects(readonly)` which means among other things that it doesn't
release any references. Being an init, however, it consumes its
arguments, and so does in fact release.

rdar://114699006
2023-08-30 12:33:58 -07:00
Ben Barham
ec1550c92a [validation] Fix line-directive validation test
This was disabled due to:
```
Unable to decode the command from the command line:
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 13-20: surrogates not allowed
```

Note that this error isn't in `line-directive`, but in Python decoding
surrogates from the command line. Not sure why that's not allowed, but
printing from within a script works so change to that.

We already set `PYTHONIOENCODING=UTF8` in the environment in
`test/lit.cfg`, which makes sure stdout is UTF8 as opposed to ASCII.

Resolves rdar://92613094.
2023-08-30 11:52:21 -07:00
swift-ci
720e423c12 Merge pull request #68199 from natecook1000/test_fix_2
Disable stdlib tests under the OS stdlib
2023-08-29 21:52:44 -07:00
Nate Cook
c7577bbe41 Disable stdlib tests under the OS stdlib
These two tests verify recent fixes, so they fail when run against
older versions of the stdlib.
2023-08-29 17:35:05 -05:00
Mike Ash
5928859970 [Test] Have rdar81421394.swift import Foundation.
This test occasionally fails due apparently not loading libswiftFoundation. The test relies on a bridging header to import the Foundation module, which seems iffy. Explicitly import Foundation instead.

rdar://114590327
2023-08-29 09:50:31 -04:00
Saleem Abdulrasool
88e62d7de2 Merge pull request #68134 from compnerd/fragility
Cxx: mark as fragile
2023-08-25 16:21:35 -07:00
Saleem Abdulrasool
dff40e9399 Cxx: mark as fragile
This library is still fragile as C++ Interop is in preview. Mark it as
fragile to match cxxStdlib.
2023-08-25 11:31:36 -07:00
Alex Hoppen
a1bfb510e1 [CodeCompletion] Migrate labeled trailing closure completions to solver-based
rdar://113472967
2023-08-24 15:41:36 -07:00
Ben Barham
8fbdae12fc [Build] Skip early-* on non-darwin hosts
These builds do not work outside of darwin currently. Rather than adding
the skip to all the necessary build presets, just disable in the product
instead.
2023-08-23 11:43:35 -07:00
Evan Wilde
0f0e68fc4c Merge pull request #68029 from etcwilde/ewilde/delete-backdeploy-concurrency
Delete backdeploy concurrency library
2023-08-23 09:03:09 -07:00
Holly Borla
d4f3bc6cd3 Merge pull request #68081 from hborla/sendable-self-in-reference 2023-08-23 06:13:38 -07:00
Holly Borla
84eaeb766f [Concurrency] Diagnose non-Sendable 'self' arguments crossing actor isolation
boundaries in member reference expressions.
2023-08-22 21:28:33 -07:00
Alex Hoppen
baa20aec52 Merge pull request #67909 from nishithshah2211/imperative-fixits
[Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
2023-08-21 14:40:21 -07:00
Evan Wilde
e54b18370d Delete backdeploy concurrency library
This library served its purpose and has overstayed its welcome.
The library shipped in Xcode can't change again from the state it was
in, so changes to the sources here will not affect that library, which
is confusing. The library does not currently build due to changes in the
runtime headers, so it does not give meaningful signal to anything
anymore. If you need to test things in a backdeploy concurrency
environment, use the copy from the toolchain in Xcode as that will give
you a far clearer picture of what the code will actually be running with
than the state of the sources here did.
2023-08-20 11:01:23 -07:00
nate-chandler
c0fa16e7be Merge pull request #68000 from nate-chandler/cherrypick/main/rdar114013709
[IRGen] Cast fixed-size opaque globals.
2023-08-18 06:59:30 -07:00
Nate Chandler
9981a82d01 [IRGen] Cast fixed-size opaque globals.
In https://github.com/apple/swift/pull/66560 , a bug in the lowering of
`global_addr` was fixed.  Part of that fix was to postpone mapping the
type of the global into context until getting the address of the global
and projecting the buffer for the out-of-line value; at that point, the
type is mapped into context and the address is cast.

It introduced an issue for fixed-size globals, however: the type of such
globals was not mapped into context; the result was that the lowered
value set for the corresponding SIL value would have the wrong type.

Fix that by extracting the code which mapped the type into context and
cast the address to the appropriate lowered type into a lambda and call
that lambda both in both the fixed-size (newly) and non-fixed-size (as
before) cases.

rdar://114013709
2023-08-17 17:23:02 -07:00
Pavel Yaskevich
b34f9720e4 [CSSimplify] Adjust {Any, Partial}KeyPath bindings right before resolving
A type variable that represents a key path literal cannot be bound
directly to `AnyKeyPath` or `PartialKeyPath`, such types could only
be used for conversions.
It used to be the task of the binding inference to infer `AnyKeyPath`
and `PartiaKeyPath` as a `KeyPath` using previously generated type
variables for a root and value associated with key path literal
(previously stored in the locator).

Recently we switched over to storing key path information in the
constraint system and introduced `resolveKeyPath` method to gain
more control over how key path type variable gets assigned.

Getting information from the constraint system creates a problem
for the inference because "undo" for some bindings would be run
after solver scope has been erased, so instead of modifying bindings
in `inferFromRelational`, let's do that in `resolveKeyPath` right
before the key path type variable gets bound which seems to be a
better place for that logic anyway.

Resolves: rdar://113760727
2023-08-15 13:50:54 -07:00
Pavel Yaskevich
cedbdf920c Merge pull request #67759 from xedin/rdar-112617922
[CSSimplify] Relax `isBindable` requirements for pack expansion variables
2023-08-15 09:00:12 -07:00
Nishith Shah
8e2e625543 [Diagnostics] Use imperative msg for protocol conformance & switch-case fixits
This commit changes fixit messages from a question/suggestion to an
imperative message for protocol conformances and switch-case. Addresses
https://github.com/apple/swift/issues/67510.
2023-08-13 22:34:26 -07:00