Commit Graph

7754 Commits

Author SHA1 Message Date
Saleem Abdulrasool
36c951d31e Revert "[DebugInfo] Ignore noescape bit for all @convention(c) pointers" 2022-04-19 18:09:23 -07:00
Anton Korobeynikov
b2dc6e5228 Unbreak the test 2022-04-18 22:43:57 +02:00
Karoy Lorentey
318277c3aa [test] stdlib/StringIndex: Spin off O(n^4) substring replacement test into a standalone long test
Also trim down its input a bit so that this doesn’t take 20 minutes.
2022-04-15 21:29:32 -07:00
Pavel Yaskevich
7a6982347b Merge pull request #42375 from xedin/rdar-66110075
[TypeChecker] NFC: Un-XFAIL SwiftUI test-case which has been fixed
2022-04-14 17:36:37 -07:00
Karoy Lorentey
57f0e67658 Merge pull request #41417 from lorentey/the-horror-of-se-0180
[stdlib] Fix String indexing edge cases, anomalies & validation bugs
2022-04-14 14:08:53 -07:00
Pavel Yaskevich
d8ade63521 [TypeChecker] NFC: Un-XFAIL SwiftUI test-case which has been fixed
Test-case should no longer produce "type of expression is ambiguous"
fallback diagnostic.

Resolves: rdar://66110075
2022-04-14 13:38:01 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Alex Hoppen
11c3ff0534 Merge pull request #42211 from ahoppen/pr/dont-distinguish-identical-convertible-type-relation
[CodeCompletion] Don't distinguish convertible and identical type relation
2022-04-13 12:01:25 +02:00
Alex Hoppen
5d01a097e1 [CodeCompletion] Don't distinguish convertible and idenical type relation
I think that preferring identical over convertible makes sense in e.g. C++ where we have implicit user-defined type conversions but since we don’t have them in Swift, I think the distinction doesn’t make too much sense, because if we have a `func foo(x: Int?)`, want don’t really want to  prioritize variables of type `Int?` over `Int` Similarly if we have `func foo(x: View)`, we don’t want to prioritize a variable of type `View` over e.g. `Text`.

rdar://91349364
2022-04-13 08:28:17 +02:00
Alex Hoppen
e313df88ce [build-script] Add option to build lld as part of LLVM 2022-04-12 16:38:34 +02:00
Alejandro Alonso
5fe6a7e247 Add caseFolded to scalar properties 2022-04-10 13:03:13 -07:00
Slava Pestov
1bf248e374 Enable parameterized protocols by default, and add new staging flag for parameterized existentials 2022-04-06 17:30:10 -04:00
Alex Hoppen
8919a3398d Merge pull request #42205 from ahoppen/pr/add-test-case-sr15502
[CodeCompletion] Add test case for SR-15502
2022-04-06 22:39:09 +02:00
nate-chandler
de0e227925 Merge pull request #42186 from nate-chandler/rdar83158525
[IRGen] Use condbrs for big int switches.
2022-04-06 07:35:34 -07:00
Alex Hoppen
f2e1f30f66 [CodeCompletion] Add test case for SR-15502 2022-04-06 09:19:12 +02:00
Karoy Lorentey
3f2550feb4 [test] stdlib/StringGraphemeBreaking: Add backwards checks 2022-04-05 21:42:17 -07:00
Slava Pestov
094130b9c7 RequirementMachine: Diagnose redundant concrete conformance requirements
A conformance requirement on a concrete type parameter is redundant if the
concrete type conforms to the protocol.

The replacement path for the conformance rule is based on a concrete
conformance rule introduced by the property map. Since the concrete
conformance rule is not associated with a requirement ID, this would
normally muffle the redundancy warning, because we don't want to
suggest removing a rule that depends on a non-redundant, non-explicit
rule.

However, concrete conformance rules don't actually appear in the
minimal signature, so skip them when computing the set of non-redundant,
non-explicit rules to ensure that the original conformance requirement
is still diagnosed as redundant.
2022-04-05 21:12:51 -04:00
Nate Chandler
602e2e7f34 [IRGen] Use condbrs for big int switches.
Previously, switches over extremely large integers (e.g. i832) were
emitted when emitting switches with many spare bits.  Such switches
result in unfortunate downstream codegen.

Here, for large enums (currently, more than two words) the preexisting
EnumPayload::emitCompare function is used to compare each of the enum
cases in turn with the payload's value.  The result is a series of
cond_br where the conditional is made by anding together word-size
chunks of the payload value with word-size chunks of each enum case's
tag, subject to masking.

rdar://83158525
2022-04-05 09:09:53 -07:00
Nate Chandler
5aa3cf6d6c [Test] Mark two unsupported for backdeploy.
They depend on new runtime changes.
2022-04-04 14:52:03 -07:00
Pavel Yaskevich
5ac54115dd Merge pull request #42159 from xedin/rdar-91150414
[TypeChecker] SE-0326: Check whether function declaration is a result…
2022-04-04 10:32:44 -07:00
Pavel Yaskevich
df549dbdb3 [TypeChecker] SE-0326: Check whether function declaration is a result builder context
This is a follow-up to https://github.com/apple/swift/pull/40708 which only considers
closures, but it missed the case when builder is applied to function body - in such
cases the declaration context is going to be a function/getter declaration.

Resolves: rdar://91150414
2022-04-04 01:13:46 -07:00
Slava Pestov
8c47cd75fd Sema: The primary associated type list references existing associated types instead of declaring new ones 2022-04-03 22:03:49 -04:00
Anthony Latsis
62a2c9e265 Merge pull request #42137 from AnthonyLatsis/objc-optional-keypath
SILGen: Handle key paths with `@objc optional` property and subscript components
2022-04-02 13:53:25 +03:00
Slava Pestov
4068c9d707 Pass -requirement-machine-{protocol,inferred}-signatures=verify in remaining tests that fail due to diagnostics 2022-04-01 23:55:34 -04:00
swift-ci
e059cc63d4 Merge pull request #42147 from glessard/sr15994
[test] check availability before executing test
2022-04-01 16:53:01 -07:00
Guillaume Lessard
3bacc7c08f [test] check availability for before running test
- resolves rdar://91181948
2022-04-01 15:37:07 -06:00
Slava Pestov
16d204bc51 Merge pull request #42133 from slavapestov/rqm-minor-diagnostics-fixes
RequirementMachine: Minor diagnostics fixes
2022-04-01 15:40:05 -04:00
swift-ci
7f80abe28c Merge pull request #42139 from nate-chandler/test/20220401/1
[Test] Check multipayload empty case storage.
2022-04-01 12:05:35 -07:00
Anthony Latsis
7b26e293ef Add regression test for https://bugs.swift.org/browse/SR-16076 2022-04-01 20:22:36 +03:00
Pavel Yaskevich
19ebc9b73c Merge pull request #42122 from xedin/rdar-90445018-x86_64-only
[TypeChecker] NFC: Restrict flaky perf test to x86_64 || arm64 macOS
2022-04-01 09:55:19 -07:00
Nate Chandler
08bf645ef7 [Test] Check multipayload empty case wrapping.
Verify the behavior of swift_storeEnumTagMultiPayload in the face of
small payload sizes (8 bits) and many empty cases (more than 2^8).

Additional test of the behavior that was fixed at
https://github.com/apple/swift/pull/42131
2022-04-01 08:30:35 -07:00
nate-chandler
2d370fb524 Merge pull request #42131 from nate-chandler/rdar87914343
[Runtime] Fixed multi-payload empty-case masking.
2022-04-01 08:22:06 -07:00
Slava Pestov
01fea564fb RequirementMachine: Skip emitting diagnostics containing ErrorTypes 2022-04-01 01:04:54 -04:00
Nate Chandler
f12a321045 [Runtime] Fixed multi-payload empty-case masking.
When storing a tag into a multi-payload enum for an empty case via
swift_storeEnumTagMultiPayload, the tag is split between the storage for
payloads (i.e. the associated values of the non-empty cases) and the
storage for tags (i.e. the integers which refer to the non-empty cases).

Typically, the number of non-empty cases (i.e. one beyond the tag
that refers to the last non-empty case) is stored into the tag storage
and the integer which distinguishes which among the empty cases the enum
is in is stored into storage for payloads.  When the enum is small,
however--specifically, when the payload size is less than four
bytes--that information is packaged differently via masking.

Previously, there was a problem with that masking.  While the value
stored into the tag storage was correct (and correctly indicated that
the enum was in some empty case), the value stored into the payload
storage was not.  The result was that which empty case an enum was in
would be corrupted.

Here, that is fixed by fixing the masking.

rdar://87914343
2022-03-31 21:09:36 -07:00
Doug Gregor
b94d6eb874 Merge pull request #42121 from xedin/rdar-91110069
[ConstraintSystem] Fix a bug in existential Self erasure
2022-03-31 20:55:34 -07:00
Nate Chandler
aff8299523 [Test] Added REQUIRES line to two.
rdar://91132726
rdar://91133163
2022-03-31 16:42:30 -07:00
Pavel Yaskevich
bac42d14b3 [TypeChecker] NFC: Restrict flaky perf test to x86_64 || arm64 macOS
Resolves: rdar://90445018
2022-03-31 14:18:27 -07:00
Pavel Yaskevich
9e3432a833 [ConstraintSystem] Fix a bug in existential Self erasure
`typeEraseExistentialSelfReferences` shouldn't account for
contextual signature because that signature could have
generic parameters of it's own unrelated to the reference
which would be located before generic parameters of the
member, e.g. when the code is located in a protocol extension,
which invalidates the assumption that `Self` is located at
depth = 0, index = 0.

Resolves: rdar://91110069
2022-03-31 13:19:33 -07:00
Slava Pestov
b4b873332f Update -requirement-machine-* flags in various tests
- Don't pass 'verify' since it's now the default
- Update tests where diagnostics changed in a correct way to pass 'on' instead
- Delete compiler_scale/explicit_requirements_perf.swift since it's not testing anything with the requirement machine
2022-03-31 15:57:36 -04:00
nate-chandler
230c435b45 Merge pull request #42106 from nate-chandler/rdar79513293
[IRGen] Bail on opt when seeing non-ABI field.
2022-03-31 07:32:50 -07:00
Nate Chandler
da5888fd3f [IRGen] Bail on opt when seeing non-ABI field.
When analyzing a struct's layout to determine whether it contains a
single non-empty field, bail upon encountering a field that is not ABI
accessible.

Previously, rather than bailing (though that was the intent), the field
was ignored.  The result was that struct's with a single non-empty field
and any number of ABI inaccessible fields would be treated as if they
only had a single non-empty field.  Trouble ensued.

rdar://79513293
2022-03-30 17:55:39 -07:00
Slava Pestov
8ea633850c Add regression test for https://bugs.swift.org/browse/SR-10792 2022-03-29 23:01:48 -04:00
Tim Kientzle
1232424b44 RemoteMirror generic multi-payload-enum fixes (#41903)
Apparently, RemoteMirror chokes on certain MPEs with generic payload types.
It does not recognize the generic payload type so ends up defaulting to a
zero size.  This causes the overall enum size to be miscalculated unless there
is another non-generic payload that's at least as large.

The case below requires us to reprocess the metatype to "thicken" it.
That process inadvertently lost information about the depth of generic
nesting, which caused the RemoteMirror to be unable to resolve the type of
`C.E.t` at runtime.
```
  class C<T> {
    enum E<T> {
    case t(T)
    case u(Int)
    }
    var e: E<T>?
  }
```

Solution: add code to the thickening logic to recursively thicken
parent types to preserve the nesting of generics.

Resolves rdar://90490128
2022-03-28 14:47:17 -07:00
Pavel Yaskevich
c03e8b5544 Merge pull request #41899 from xedin/rdar-90419017
[Diagnostics] Ignore type mismatches related to synthesized arguments
2022-03-25 14:47:52 -07:00
Slava Pestov
d40e30db27 Merge pull request #42017 from slavapestov/rqm-rule-length-heuristic
RequirementMachine: Tweak rule limit non-termination heuristic
2022-03-25 11:44:27 -04:00
Nate Cook
e2a394b435 Disable String breadcrumbs tests for freestanding stdlib (#42000) 2022-03-25 07:46:22 -05:00
Anthony Latsis
38e48ac15d TypeWitnessSystem: Disable by default 2022-03-25 08:45:54 +03:00
Slava Pestov
7d0215e6e0 RequirementMachine: Tweak rule limit non-termination heuristic
Add the length of the longest *initial* rule to the rule length limit
before comparing.

Fixes https://bugs.swift.org/browse/SR-16024.
2022-03-25 01:00:49 -04:00
Kuba (Brecka) Mracek
e48cd332ff Mark validation-test/stdlib/StringBreadcrumbs.swift as UNSUPPORTED: freestanding (#41991) 2022-03-24 06:57:23 -07:00
Pavel Yaskevich
9d413b3668 Merge pull request #41939 from xedin/rdar-87407899
[Diagnostics] Fix out-of-bounds index while fixing argument mismatch
2022-03-22 22:46:54 -07:00