Commit Graph

531 Commits

Author SHA1 Message Date
Apollo Zhu
b09a22a9a0 Somewhat working
Test shadowed variable of same type

Fully type check caller side macro expansion

Skip macro default arg caller side expr at decl primary

Test macro expand more complex expressions

Set synthesized expression as implicit

Add test case for with argument, not compiling currently

Test with swiftinterface

Always use the string representation of the default argument

Now works across module boundary

Check works for multiple files

Make default argument expression work in single file

Use expected-error

Disallow expression macro as default argument

Using as a sub expression in default argument still allowed as expression macros behave the same as built-in magic literals
2024-02-06 15:02:11 -08:00
Pavel Yaskevich
a77d119c99 Merge pull request #71261 from xedin/introduce-thunks-for-runtime-check-func-refs
[Sema/SILGen] DynamicActorIsolation: Implement dynamic actor isolation checks for unsafe APIs
2024-02-02 13:32:00 -08:00
Pavel Yaskevich
f75d02ab56 Merge pull request #71312 from xedin/promote-flag-for-infersendable-from-capture
[Frontend] NFC: Promote InferSendableFromCaptures to an upcoming feat…
2024-02-02 09:37:28 -08:00
Pavel Yaskevich
db7959668e [Frontend] NFC: Rename PreconcurrencyConformances to DynamicActorIsolation 2024-02-01 13:28:25 -08:00
Pavel Yaskevich
c7c7df3329 [Frontend] NFC: Promote InferSendableFromCaptures to an upcoming feature in Swift 6 2024-02-01 10:56:22 -08:00
Kavon Farvardin
5f977ca763 NCGenerics: force module mismatches 2024-01-31 14:00:08 -08:00
Nate Chandler
03f904af0c [MoveChecker] Separate partial reinit from consume 2024-01-29 18:29:40 -08:00
Joe Groff
960938f87e SILGen: Always match noncopyable values by borrowing.
Even if the final pattern ends up consuming the value, the match itself
must be nondestructive, because any match condition could fail and cause
us to have to go back to the original aggregate. For copyable values,
we can always copy our way out of consuming operations, but we don't
have that luxury for noncopyable types, so the entire match operation
has to be done as a borrow.

For address-only enums, this requires codifying part of our tag layout
algorithm in SIL, namely that an address-only enum will never use
spare bits or other overlapping storage for the enum tag. This allows
us to assume that `unchecked_take_enum_data_addr` is safely non-side-
effecting and match an address-only noncopyable enum as a borrow.
I put TODOs to remove defensive copies from various parts of our
copyable enum codegen, as well as to have the instruction report
its memory behavior as `None` when the projection is nondestructive,
but this disturbs SILGen for existing code in ways SIL passes aren't
yet ready for, so I'll leave those as is for now.

This patch is enough to get simple examples of noncopyable enum switches
to SILGen correctly. Additional work is necessary to stage in the binding
step of the pattern match; for a consuming switch, we'll need to end
the borrow(s) and then reproject the matched components so we can
consume them moving them into the owned bindings. The move-only checker
also needs to be updated because it currently always tries to convert
a switch into a consuming operation.
2024-01-19 13:59:04 -08:00
Pavel Yaskevich
4943e146bd [Frontend] Add experimental flag for @preconcurrency conformances feature 2024-01-16 10:31:01 -08:00
Holly Borla
fcbe5593a3 Merge pull request #70871 from hborla/fix-complete-concurrency-flags
[Concurrency] Promote `StrictConcurrency` to an upcoming feature flag.
2024-01-12 09:41:58 -08:00
Holly Borla
d37b9763b6 [Concurrency] Promote StrictConcurrency to an upcoming feature flag. 2024-01-11 21:23:25 -08:00
Allan Shortlidge
04ca86b0d2 Merge pull request #70852 from tshortli/suppressible-extern-feature
[c-interop] Make Extern a suppressible language feature
2024-01-11 16:38:51 -08:00
Allan Shortlidge
ba1f50fddb [c-interop] Make Extern a suppressible language feature.
Fixes building the standard library's .swiftinterface with older Swift
compilers.
2024-01-11 13:54:24 -08:00
Allan Shortlidge
100e5ee797 [Concurrency] Fix more missing builtin guards for DiscardingTaskGroup.
Follow-up to https://github.com/apple/swift/pull/70837.
2024-01-11 10:22:55 -08:00
Holly Borla
7d2d91a38f Merge pull request #70257 from hborla/isolated-default-values-upcoming-flag
[SE-0411] Promote `IsolatedDefaultValues` from an experimental feature to an upcoming feature.
2024-01-11 06:57:15 -08:00
Konrad `ktoso` Malawski
ef80d778dc [Concurrency] Fix the missing builtin guards for DiscardingTaskGroup (#70837) 2024-01-10 22:55:38 -08:00
Holly Borla
0e71623386 [SE-0411] Promote IsolatedDefaultValues from an experimental feature to an
upcoming feature.
2024-01-10 14:54:24 -08:00
Holly Borla
f15ef1a055 [Concurrency] Allow isolated parameters to have optional type. 2024-01-09 21:37:24 -08:00
Sophia Poirier
073f541734 [Concurrency] promote GlobalConcurrency from experimental to future feature 2024-01-06 19:07:23 -08:00
Ben Barham
d51c58a6f9 [Basic] hasFeature should succeed for promoted language features
Merge `$<Feature>` and `hasFeature` implementations.
  - `$<Feature>` did not support upcoming language features.
  - `hasFeature` did not support promoted language features and also
    didn't take into account `Options` in `Features.def`.

Remove `Options` entirely, it was always one of three cases:
  - `true`
  - `langOpts.hasFeature`
  - `hasSwiftSwiftParser`

Since `LangOptions::hasFeature` should always be used anyway, it's no
longer necessary. `hasSwiftSwiftParser` can be special cased when adding
the default promoted language features (by removing those features).

Resolves rdar://117917456.
2024-01-05 10:26:13 -08:00
Doug Gregor
baaa8f3e5b Merge pull request #70677 from DougGregor/se-0413-typed-throws
Enable SE-0413 "Typed Throws" by default
2024-01-04 16:11:26 -08:00
Doug Gregor
b9c5aca15f Enable SE-0413 "Typed Throws" by default 2024-01-02 15:34:07 -08:00
Michael Gottesman
abba624f6e Add an experimental option TransferringArgsAndResults.
Just splitting off a larger commit to make this easier to review.
2024-01-02 15:03:05 -08:00
Angela Laar
c1af52c2f2 Merge pull request #70419 from angela-laar/group-actor-isolation-errors
Group actor isolation errors
2023-12-18 08:42:26 -08:00
Andrew Trick
ace9937e95 Rename NonesapableTypes feature
Follow the feature flag convention for capitalization and be
consistent with the related NoncopyableGenerics feature.

This is a new feature that no wild Swift code has used it yet:

commit e99ce1cc5d
Author: Kavon Farvardin <kfarvardin@apple.com>
Date:   Tue Dec 5 23:25:09 2023

    [NCGenerics] add `~Escapable`

    Basic implementation of `~Escapable` in the type system.
2023-12-14 11:32:03 -08:00
Erik Eckstein
88173948d9 make FixedArrays feature available in non-assert compiler builds 2023-12-13 17:06:25 +01:00
Angela Laar
4d2b01b0be Group Actor Isolation errors
The number of errors in a function scope can scale exponentially,
making it hard to root cause and resolve unless we group them into
a single error. Grouping the error diagnostics will considerably
improve the concurrency user experience.
2023-12-12 16:23:10 -08:00
Konrad `ktoso` Malawski
828f589be4 Initial Task Executor implementation Task(on:), addTask(on:) etc. (#68793)
Co-authored-by: John McCall <rjmccall@gmail.com>
2023-12-12 17:14:24 +09:00
eeckstein
484fc77a8c Merge pull request #70301 from eeckstein/fixed-array
Add experimental support for fixed arrays
2023-12-11 09:36:29 +01:00
Erik Eckstein
a0f8d65be7 AST: add feature flag "FixedArrays" 2023-12-09 18:49:57 +01:00
Erik Eckstein
dd9ce40ba1 add the allocVector builtin 2023-12-09 18:49:57 +01:00
Slava Pestov
335d6ffea1 Frontend: Add -disable-experimental-associated-type-inference flag 2023-12-08 13:39:10 -05:00
nate-chandler
54a152f284 Merge pull request #69938 from nate-chandler/rdar96919870/1/bitwise-copyable-protocol
[BitwiseCopyable] Add a marker protocol.
2023-12-01 06:57:11 -08:00
Holly Borla
2aa8d56997 Merge pull request #70123 from hborla/swift-6-upcoming-features
[Features] Update upcoming feature flags for Swift 6.
2023-11-30 19:00:20 -08:00
Nate Chandler
b266abe5c0 [BitwiseCopyable] Add a marker protocol.
Behind the experimental feature BitwiseCopyable.
2023-11-30 15:25:46 -08:00
Holly Borla
575514e906 [Feataures] Add an upcoming feature flag for complete concurrency checking. 2023-11-29 22:09:37 -08:00
Zhiyu Zhu/朱智语
9d1a92eb72 [Compile Time Constant Extraction] Add @extractConstantsFromMembers (#69944)
Add @extractConstantsFromMembers attribute under ExtractConstantsFromMembers experimental feature flag
2023-11-29 08:49:57 -08:00
Holly Borla
7cb9880b04 [Features] Gate SE-0383 behind an upcoming feature flag. 2023-11-29 07:35:37 -08:00
Holly Borla
d135ce7ce4 [Features] Don't enable ExistentialAny by default in Swift 6. 2023-11-28 09:47:14 -08:00
Doug Gregor
0eb71d1c03 Merge pull request #70034 from DougGregor/function-body-macros
Function body macros
2023-11-28 09:43:40 -08:00
Alejandro Alonso
e214ba5092 Merge pull request #69735 from Azoy/static-exclusive-only
Introduce @_staticExclusiveOnly
2023-11-27 21:24:56 -08:00
Doug Gregor
36a2dcd927 Implement function body macros
Function body macros allow one to introduce a function body for a
particular function, either providing a body for a function that
doesn't have one, or wholesale replacing the body of a function that
was written with a new one.
2023-11-27 17:04:55 -08:00
Ben Rimmington
badac8fd10 [SE-0413] Update Features.def (#70038)
* Fix SE-number of `FullTypedThrows` feature.
* Fix copyright years.
2023-11-27 18:33:33 +00:00
Alejandro Alonso
7da7c73c71 Introduce @_staticExclusiveOnly 2023-11-27 09:11:13 -08:00
Rintaro Ishizaki
f3f4b19776 [ASTGen] Remove ASTGenTypes experimental feature
There's no reason to generate only TypeRepr using ASTGen anymore.
Use ParserASTGen feature to test test/ASTGen/types.swift because
ASTGen now can generate the whole test file for type checking.
2023-11-12 21:43:09 -08:00
Angela Laar
eb277d9ee7 Merge pull request #67498 from angela-laar/implicit-sendable-for-methods
[Sema] Implicitly add @Sendable attribute to partial methods
2023-11-07 16:46:16 -08:00
Angela Laar
c09ec72e85 [Constraint System] Always add Sendable to unapplied function applications 2023-11-07 13:37:24 -08:00
Yuta Saito
79b3d2d626 Add underscore prefix to extern attribute
It's already guarded by a feature flag, but it would be nice to signal
users that it's not stable yet by adding an underscore prefix.
2023-11-07 02:01:02 +00:00
Michael Gottesman
cb46851194 [region-isolation] Rename the experimental feature to RegionBasedIsolation.
This ensures that the pass is called TransferNonSendable but the experimental
feature is RegionBasedIsolation.
2023-10-26 12:01:44 -07:00
Michael Gottesman
0bad8f9b67 [region-isolation] Rename SendNonSendable.cpp -> TransferNonSendable.cpp. 2023-10-26 12:01:44 -07:00