Commit Graph

7628 Commits

Author SHA1 Message Date
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
Pavel Yaskevich
b6c2b3edff [Diagnostics] Fix out-of-bounds index while fixing argument mismatch
Although the overload choice has two parameters, it doesn't
mean that there are exactly two arguments passed to it.

Resolves: rdar://87407899
2022-03-21 14:57:50 -07:00
Alejandro Alonso
908161136d Renable StringMemoryTest 2022-03-21 13:33:42 -07:00
Alex Hoppen
458ce70245 Merge pull request #41633 from ahoppen/pr/solver-based-global-completions
[CodeCompletion] Migrate expression completions to solver-based
2022-03-21 20:02:47 +01:00
Alex Hoppen
e2a62f1a60 [CodeCompletion] Migrate expression completions to solver-based 2022-03-21 13:00:33 +01:00
Kavon Farvardin
9b1fcedf2f backtrack on part of SE-327 dealing with default-value exprs
This effectively reverts 6823744779

The blanket removal of isolation in default-value expressions had
unintented consequences for important workflows. It's still
a problem that needs to be addressed, but we need to be more precise
about the problematic situations.
2022-03-18 18:41:05 -07:00
Pavel Yaskevich
fc83c6fa68 [Diagnostics] Ignore type mismatches related to synthesized arguments
The main issue is the absence of the argument itself.

Resolves: rdar://90419017
2022-03-18 14:54:15 -07:00
David Smith
cb082e185c Merge pull request #41866 from Catfish-Man/what-a-crumb-y-optimization
Vectorize UTF16 offset calculations
2022-03-18 09:53:55 -07:00
Alex Hoppen
1680ec3f08 Merge pull request #41853 from ahoppen/pr/add-fixed-test-cases
[CodeCompletion] Add test cases
2022-03-18 17:09:11 +01:00
Slava Pestov
e6d1ef9f6d Merge pull request #41868 from slavapestov/rqm-opaque-archetypes
RequirementMachine: Opaque archetype support (sort of)
2022-03-17 23:06:24 -04:00
nate-chandler
b2588656d8 Merge pull request #41478 from nate-chandler/lexical_lifetimes/destroy-hoisting/disable
[SILOpt] Disabled DestroyHoisting.
2022-03-17 17:26:11 -07:00
Slava Pestov
2f727d6b47 RequirementMachine: Opaque archetype support (sort of)
Complete support is behind a flag, because it can result in a non-convergent
rewrite system if the opaque result type has a recursive conformance of its
own (eg, `some View` for SwiftUI's View protocol).

Without the flag, it's good enough for simple examples; you just can't have
a requirement that mentions a nested type of a type parameter equated to
the concrete type.

Fixes rdar://problem/88135291, https://bugs.swift.org/browse/SR-15983.
2022-03-17 17:45:59 -04:00
Alex Hoppen
17ac201b29 Merge pull request #39373 from ahoppen/pr/solver-based-arg-completion
[CodeCompletion] Migrate argument position completion to the solver-based implementation
2022-03-17 22:41:59 +01:00
David Smith
eaf3f316ec Vectorize UTF16 offset calculations 2022-03-17 14:18:21 -07:00
Slava Pestov
7390f7d8bc Merge pull request #41842 from slavapestov/gsb-relax-verify-check
GSB: Relax -requirement-machine-protocol-signatures=verify check a little
2022-03-17 17:07:00 -04:00
Pavel Yaskevich
10324641f9 [TypeChecker] NFC: Restrict multi-statement closure + simd test-case to macOS
Resolves: rdar://90445018
2022-03-17 12:10:31 -07:00
Nate Chandler
979196cb16 [Test] For disabling destroy hoisting. 2022-03-17 12:06:53 -07:00
Alex Hoppen
f538d33e5f [CodeCompletion][Sema] Migrate CallArgurment position completion to the solver-based implementation
This hooks up call argument position completion to the typeCheckForCodeCompletion API to generate completions from all the solutions the constraint solver produces (even those requiring fixes), rather than relying on a single solution being applied to the AST (if any).

Co-authored-by: Nathan Hawes <nathan.john.hawes@gmail.com>
2022-03-17 15:15:54 +01:00
Alex Hoppen
4af49e3479 [CodeCompletion] Add test cases
Add test cases for three issues that have been fixed on main
- SR-14693
- SR-14704
- SR-14739
2022-03-17 09:03:17 +01:00
Slava Pestov
f518c80f4b Move validation-test/compiler_crashers_2/sr8968.swift to test/Generics/ since it passes with the Requirement Machine 2022-03-16 23:23:10 -04:00
Guillaume Lessard
b17b1a9d04 Merge pull request #41836 from glessard/sr15994
[stdlib] tolerate empty source buffers in `UMRBP.copyMemory`
2022-03-16 16:24:44 -06:00
Pavel Yaskevich
839b483f1b Merge pull request #41824 from xedin/rdar-85516390
[CSDiagnostics] Contextual failure could result in optional chain hav…
2022-03-16 10:33:39 -07:00
Guillaume Lessard
cc60db78e1 [test] validate behaviour when copying from an empty buffer 2022-03-16 10:06:20 -06:00
Robert Widmann
1afdb47271 Un-XFAIL Stdlib Validation Test 2022-03-15 21:07:57 -07:00
Pavel Yaskevich
5331e276d5 Merge pull request #41730 from xedin/se-0326-solve-pattern-bindings-via-conjunctions
[SE-0326] Re-enable multi-statement closure inference by default
2022-03-15 13:21:03 -07:00
Pavel Yaskevich
6fb5c3042b [CSDiagnostics] Contextual failure could result in optional chain having non-optional type
Fixes a crash during diagnostics by not assuming that optional chain
would always produce an optional type, which is not true because in
error scenarios it could get assigned an invalid type from context.

Resolves: rdar://85516390
2022-03-15 13:14:48 -07:00
Alejandro Alonso
27e6241a41 Merge pull request #41389 from Azoy/fix-indic-sequences
[stdlib] Fix backwards count of Indic graphemes
2022-03-14 12:08:21 -07:00