Commit Graph

7604 Commits

Author SHA1 Message Date
Slava Pestov
af8c8f1671 Sema: Remove non-experimental associated type inference 2024-03-07 17:30:17 -05:00
Slava Pestov
41df661160 AST: Use a builtin conformance for unconditional Copyable/Escapable
This generalizes what we were already doing for classes.
2024-03-07 15:07:47 -05:00
Meghana Gupta
f3a85b118f Add build-script option and lit config for nonescapable_types
With this build-script has a flag --enable-experimental-nonescpable-types=1
to enable this feature in stdlib.

Also we can now add // REQUIRES: nonescapable_types to tests which run only when
the compiler is built with this feature turned on.
2024-03-06 21:57:03 -08:00
Slava Pestov
3662bb2a28 Remove REQUIRES: asserts from fixed crashers 2024-03-06 21:38:28 -05:00
cui fliter
127077b3aa chore: fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-05 17:23:22 +08:00
Nate Chandler
0075682b4d [IRGen] Single payload enums consumes call deinits
The include the necessary metadata.
2024-03-01 21:01:50 -08:00
Nate Chandler
ae9d501d77 [Test] Mix in another experimental feature. 2024-03-01 21:01:49 -08:00
Holly Borla
9ba481ad53 [Diagnostics] Clarify the wording of error_in_future_swift_version. 2024-03-01 12:05:51 -08:00
Kuba (Brecka) Mracek
ecbe758d2e Merge pull request #71986 from kubamracek/dont-strip-builtins
[build-script] Avoid stripping clang builtin .a libraries when extracting dSYMs on Darwin
2024-03-01 06:43:48 -08:00
Slava Pestov
064c8c5bf7 Merge pull request #71995 from slavapestov/ncgenerics-fixes-6
Non-copyable generics fixes
2024-03-01 07:34:00 -05:00
John McCall
237dd4faab Merge pull request #71970 from rjmccall/isolated-any-availability
Fix metadata availability testing for parameterized existentials and implement it for @isolated(any) function types
2024-03-01 04:11:22 -05:00
John McCall
0f076c0702 Fix metadata availability testing for parameterized existentials
and implement it for @isolated(any) function types.

The existing testing was pretty broken: we were diagnosing all sorts
of things that don't require type metadata (like using a tuple with
an extended existential in a value position in an API signature)
and not diagnosing several things that do (like covariant function
conversions that erase types).  There's therefore some risk to this
patch, but I'm not too worried because needing metadata like this is
pretty uncommon, and it's likely that programs won't build correctly
anyway --- it'll just get caught by the linker instead of the compiler.
2024-02-29 22:14:49 -05:00
Slava Pestov
2f4ed5a949 Sema: Clean up diagnoseMissingOwnership()
- Pass down the TypeResolution instance so we can get the generic
  signature. This ensures we always use the correct signature in
  SIL mode.

- Don't diagnose if the type contains error types.
2024-02-29 18:13:28 -05:00
Kuba Mracek
0f2cbbf955 Adjust expectations on xargs parameters in validation-test/BuildSystem/dsymutil_jobs.test 2024-02-29 13:53:56 -08:00
Slava Pestov
d3aa3a8db9 Adjust XFAILs 2024-02-29 13:55:48 -05:00
Nate Chandler
6100a1b495 Allow partial consumption of self in deinit.
Basic support for partial consumption in deinit without full support for
all future uses of drop_deinit.
2024-02-28 15:57:09 -08:00
Slava Pestov
40cbdd35bc Merge pull request #71905 from slavapestov/fix-rdar123543175
AST: Fix crash with circular raw value
2024-02-27 06:55:10 -05:00
Slava Pestov
f2bd764381 AST: Fix crash with circular raw value
Fixes rdar://problem/123543175.
2024-02-26 19:56:19 -05:00
Alex Hoppen
0b580f7155 Merge pull request #71587 from ahoppen/ahoppen/nested-call-completion
[CodeCompletion] Always suggest call pattern for nested function calls
2024-02-26 09:14:15 -08:00
Doug Gregor
0c9c734f7e Merge pull request #71722 from DougGregor/diagnostic-style-swift-default 2024-02-24 14:42:38 -10:00
Pavel Yaskevich
4548b2a861 Merge pull request #71817 from xedin/rdar-122598934
[ConstraintSystem] Account for situations when witness for associated…
2024-02-23 09:20:26 -08:00
Pavel Yaskevich
239bfacee3 [ConstraintSystem] Account for situations when witness for associated type is null
In some circularity cases `getAssociatedType` would produce a `Type()`,
we need to account for that in `TypeSimplifier` to avoid crashing.
2024-02-22 10:55:33 -08:00
Alex Hoppen
17520dcf6d [CodeCompletion] Always suggest call pattern for nested function calls
When completing in cases like `bar(arg: foo(|, option: 1)`, we don’t know if `option` belongs to the call to `foo` or `bar`. Be defensive and also suggest the signature.
2024-02-21 18:53:07 -08:00
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00
Pavel Yaskevich
4aa8fe308b Merge pull request #71756 from xedin/pr-71701-nil-in-init
[CSSimplify] Adjust `isBindable` to reject binding if it's directly t…
2024-02-21 09:28:01 -08:00
Mishal Shah
b488702cc9 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 21:04:47 -08:00
Slava Pestov
e7d7f6f69f RequirementMachine: Add Copyable/Escapable requirements to 'placeholder' generic signatures
If we fail to build a generic signature (or requirement signature of a
protocol) because of a request cycle or because Knuth-Bendix completion
failed, we would create a placeholder signature with no requirements.

However in a move-only world, a completely unconstrained generic
parameter might generate spurious diagnostics when used in a copyable
way. For this reason, let's outfit these placeholder signatures with
a default set of conformance requirements to Copyable and Escapable.
2024-02-20 18:26:05 -05:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Pavel Yaskevich
2eda1cb9a6 [CSSimplify] Adjust isBindable to reject binding if it's directly to a type variable
Although inference doesn't allow direct bindings to
type variables, they can still get through via `matchTypes`
when type is a partially resolved pack expansion that simplifies
down to a type variable.
2024-02-20 13:42:43 -08:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Michael Gottesman
997413ab52 Add a test that makes sure that in ./include and ./lib "#pragma clang optimize off" does not exist.
This is a useful debugging tool, but we really do not want it to sneak into the
code base by mistake.
2024-02-19 13:13:04 -08:00
Doug Gregor
c142205a50 Resolve an old compiler crasher via the new diagnostic formatter
The old diagnostic formatter would crash on some Fix-Its involving
Unicode characters. The new one does not.
2024-02-19 02:48:37 -10:00
Doug Gregor
8cd2f34654 Generalize tests for both diagnostic styles, or force the LLVM style
These tests are using FileCheck to check the result of diagnostic
formatting in ways that don't match the new formatter. Force the old
formatter or, where possible, generalize so that they match both
formatters.
2024-02-19 02:48:37 -10:00
Slava Pestov
70c9f8a47e RequirementMachine: Leave behind conflicting requirements in the minimized signature
Requirement lowering only expects that it won't see two requirements
of the same kind (except for conformance requirements). So only mark
those as conflicting.

This addresses a crash-on-invalid and improves diagnostics for
move-only generics, because a conflict won't drop the copyability
of a generic parameter and expose a move-only-naive user to
confusing error messages.

Fixes #61031.
Fixes #63997.
Fixes rdar://problem/111991454.
2024-02-15 14:32:31 -05:00
Slava Pestov
06b1aee360 Evaluator: Cache circular evaluation to avoid redundant diagnostics
Previously, if a request R evaluated itself N times, we would emit N
"circular reference" diagnostics. These add no value, so instead let's
cache the user-provided default value on the first circular evaluation.

This changes things slightly so that instead of returning an
llvm::Expected<Request::OutputType>, various evaluator methods take
a callback which can produce the default value.

The existing evaluateOrDefault() interface is unchanged, and a new
evaluateOrFatal() entry point replaces
llvm::cantFail(ctx.evaluator(...)).

Direct callers of the evaluator's operator() were updated to pass in
the callback. The benefit of the callback over evaluateOrDefault() is
that if the default value is expensive to constuct, like a dummy
generic signature, we will only construct it in the case where a
cycle actually happened, otherwise we just delete the callback.

(cherry picked from commit b8fcf1c709efa6cd28e1217bd0efe876f7c0d2b7)
2024-02-09 16:02:24 -08:00
Eric Miotto
2072bf8d3f CMake: run generate_xcode.txt only for the host platform (#71279)
Currently the test assumes that when we are testing for macOS we are
targeting the host architecture (since we need to reuse existing build
products to contain testing time) -- however there are some Apple
internal configurations in which that's not the case.

Addresses rdar://118337598
2024-02-05 16:15:46 -08:00
Slava Pestov
387156ae11 Merge pull request #71354 from slavapestov/check-type-witness-fix
Sema: Fix problems with checkTypeWitness()
2024-02-03 08:28:14 -05:00
Slava Pestov
477e0572c2 Sema: Tighten invariants in associated type inference 2024-02-02 23:30:44 -05:00
Slava Pestov
ea15d9f9b2 Stop passing -warn-redundant-requirements in tests 2024-02-02 14:57:19 -05:00
Guillaume Lessard
114f235d17 Merge pull request #71167 from vanvoorden/vanvoorden/inclusive-language
[Inclusive Language][Comments][Documentation] migrate "sanity" checks to "soundness" checks
2024-02-02 10:27:34 -08:00
Ian Anderson
288f37b2c1 [Concurrency] [shims] Don't declare exit in the concurrency shims
Don't delete the OS declaration of `exit` because the concurrency shims aren't always imported, and so the shim declaration might not always be available.
Don't override the OS declaration of `exit` in the concurrency shims since we can't just delete the OS one. Instead, set up internal shims just for building Concurrency that forward declares `exit`.
2024-01-29 16:25:46 -08:00
John McCall
41cdfb04ad Introduce a proper TypeAttribute class hierarchy.
The old TypeAttributes reprsentation wasn't too bad for a small number of
simple attributes.  Unfortunately, the number of attributes has grown over
the years by quite a bit, which makes TypeAttributes fairly bulky even at
just a single SourceLoc per attribute.  The bigger problem is that we want
to carry more information than that on some of these attributes, which is
all super ad hoc and awkward.  And given that we want to do some things
for each attribute we see, like diagnosing unapplied attributes, the linear
data structure does require a fair amount of extra work.

I switched around the checking logic quite a bit in order to try to fit in
with the new representation better.  The most significant change here is the
change to how we handle implicit noescape, where now we're passing the
escaping attribute's presence down in the context instead of resetting the
context anytime we see any attributes at all.  This should be cleaner overall.

The source range changes around some of the @escaping checking is really a
sort of bugfix --- the existing code was really jumping from the @ sign
all the way past the autoclosure keyword in a way that I'm not sure always
works and is definitely a little unintentional-feeling.

I tried to make the parser logic more consistent around recognizing these
parameter specifiers; it seems better now, at least.
2024-01-28 22:30:26 -05:00
Slava Pestov
5eb32261aa Merge pull request #71169 from slavapestov/one-more-round-of-fixes
One more round of associated type inference fixes
2024-01-26 17:32:00 -05:00
Slava Pestov
c5c6e00d0e Pass -disable-experimental-associated-type-inference in a compiler_crasher pending further investigation 2024-01-25 22:01:44 -05:00
Rick van Voorden
f8ae46b3f3 [inclusive-language] changed sanity to soundness 2024-01-25 18:18:02 -08:00
Slava Pestov
991a6de207 Merge pull request #71131 from slavapestov/conformance-checker-vs-type-witnesses-untangling
Sema: Decouple type witness resolution from the ConformanceChecker
2024-01-25 20:06:01 -05:00
Pavel Yaskevich
609eaf762e Merge pull request #71146 from xedin/disable-one-swiftui-test
[Tests] NFC: Remove one of SwiftUI test-cases because its overly SDK …
2024-01-25 08:54:20 -08:00
Pavel Yaskevich
da14b97875 [Tests] NFC: Remove one of SwiftUI test-cases because its overly SDK sensitive 2024-01-24 21:15:14 -08:00
Slava Pestov
2764333fea Sema: Introduce ResolveTypeWitnessesRequest 2024-01-24 21:45:34 -05:00
Kavon Farvardin
ba2f05cce2 NCGenerics: adjust number of diagnostics
Something I changed in the implementation of NoncopyableGenerics has
gotten the number back down to 6, where it was before I started :)
2024-01-23 22:42:38 -08:00