Pavel Yaskevich
8a0a083a45
Merge pull request #77797 from xedin/locatable-types
...
[AST/Sema] Introduce a new type that has associated location in source
2024-12-02 16:33:43 -08:00
Kuba Mracek
576616307f
[Mangling] Temporarily stage out (#ifdef out) the ASTMangler API changes and Embedded Swift prefix
2024-12-02 15:01:24 -08:00
Kuba Mracek
8a872b4a79
[Mangling] Also use the new ASTMangler::Context member in ASTMangler.cpp instead of getASTContext() calls
2024-12-02 15:01:24 -08:00
Kuba Mracek
9c77074cac
[Mangling] Establish a new mangling prefix for Embedded Swift: $e
2024-12-02 15:01:24 -08:00
Kuba Mracek
6f4ae28520
[ASTMangler] Pass ASTContext to all instantiations of ASTMangler
2024-12-02 15:01:04 -08:00
Allan Shortlidge
e131682e19
Merge pull request #77886 from tshortli/consolidate-availability-queries-on-decl
...
AST: Consolidate queries for `@available` attributes on `Decl`
2024-12-02 14:21:45 -08:00
Egor Zhdan
525d9169d1
Merge pull request #77867 from swiftlang/egorzhdan/nfc-msvc-warning
...
[AST] NFC: Fix build warning on Windows
2024-12-02 16:21:44 +00:00
Allan Shortlidge
d8c946d186
AST: Introduce Decl::getActiveAvailableAttrForCurrentPlatform().
2024-12-02 07:35:58 -08:00
Allan Shortlidge
5cdcb5d116
AST: Introduce Decl::getNoAsyncAttr().
2024-12-02 07:35:58 -08:00
Allan Shortlidge
5143382265
AST: Introduce Decl::isUnavailableInCurrentSwiftVersion().
2024-12-02 07:35:58 -08:00
Allan Shortlidge
c5398e17d3
AST: Introduce Decl::getDeprecatedAttr().
...
It replaces `DeclAttr::getDeprecated()` as the designated way to query for the
attribute that makes a decl deprecated.
2024-12-02 07:35:58 -08:00
Allan Shortlidge
3e50a90c45
AST: Introduce Decl::getUnavailableAttr().
...
It replaces `DeclAttr::getUnavailable()` and `AvailableAttr::isUnavailable()`
as the designated way to query for the attribute that makes a decl unavailable.
2024-12-02 07:35:58 -08:00
Allan Shortlidge
2358712870
AST/Sema: Remove DeclAttr::isUnavailable().
...
Update callers to use `Decl::isUnavailable()` instead.
2024-12-02 07:35:58 -08:00
Allan Shortlidge
1dc7aa5b7b
AST: Introduce Decl::isUnavailable().
...
Replace calls to `AvailableAttr::isUnavailable()` with `Decl::isUnavailable()`.
2024-12-02 07:35:58 -08:00
Hamish Knight
73fb36f371
[AST] Split out "is compound" bit on FunctionRefInfo
...
FunctionRefKind was originally designed to represent
the handling needed for argument labels on function
references, in which the unapplied and compound cases
are effectively the same. However it has since been
adopted in a bunch of other places where the
spelling of the function reference is entirely
orthogonal to the application level.
Split out the application level from the
"is compound" bit. Should be NFC. I've left some
FIXMEs for non-NFC changes that I'll address in a
follow-up.
2024-12-02 14:11:33 +00:00
Hamish Knight
a4d51419ba
[AST] NFC: Rename FunctionRefKind -> FunctionRefInfo
2024-12-02 14:11:32 +00:00
Allan Shortlidge
cd13d7d777
AST: Remove AvailableAttr::RenameDecl.
...
The renamed decl is now stored exclusively in the split request evaluator
storage, which is more efficient since most availability attributes do not
specify a renamed decl.
2024-11-29 10:35:02 -05:00
Allan Shortlidge
b6353b0abd
AST: Don't copy cached rename decls when inferring availability.
2024-11-29 10:34:49 -05:00
Allan Shortlidge
e6741d5e9e
AST: Adopt ValueDecl::getRenamedDecl().
...
This unblocks removing `RenameDecl` from `AvailableAttr`.
2024-11-29 10:34:49 -05:00
Allan Shortlidge
9d884bfbcb
AST: Adopt split caching for RenamedDeclRequest.
...
In the common case where there is no renamed decl for the attribute, just set a
few bits in inline storage for `AvailableAttr`.
2024-11-29 10:34:49 -05:00
Egor Zhdan
839f8411b3
[AST] NFC: Fix build warning on Windows
...
This fixes a warning emitted by MSVC when building Swift.
2024-11-28 13:30:19 +00:00
Jakub Florek
866f1c1c04
Merge branch 'main' into swift-lexical-lookup-validation
2024-11-26 09:37:23 +01:00
Allan Shortlidge
5de7211984
AST: Rename createForAlternative() to createForAsyncAlternative().
2024-11-22 14:35:47 -08:00
Allan Shortlidge
88c0638f37
AST: Introduce a ValueDecl convenience for looking up the renamed decl.
...
Wrap `RenamedDeclRequest` instead of evaluating it directly.
2024-11-22 14:35:23 -08:00
Slava Pestov
d11db16f16
Merge pull request #77786 from slavapestov/workaround-rdar139469939
...
AST: Workaround for rdar://139469939
2024-11-21 19:15:07 -05:00
Pavel Yaskevich
eaef8e7474
Merge pull request #77778 from xedin/remove-substituion-printing-for-opaque-decls
...
[ASTDumper] Don't try to print opaque type decl substitutions
2024-11-21 15:16:03 -08:00
Allan Shortlidge
ad7383499b
Merge pull request #77758 from tshortli/available-attr-conveniences
...
AST: `AvailableAttr` cleanup
2024-11-21 13:03:07 -08:00
Slava Pestov
b70c76233e
AST: Workaround for rdar://139469939
...
This unconditional assert was added recently so it started failing in
noassert toolchains. I'll have a proper fix soon.
2024-11-21 15:24:35 -05:00
Hamish Knight
23e3f5f5de
Merge pull request #77666 from hamishknight/lets-try-this-again
...
[AST] Remove `ModuleDecl::addFile`
2024-11-21 20:15:58 +00:00
Pavel Yaskevich
0fe4cea7d7
[AST] Introduce a new type that has associated location in source
...
This type is intended to be used to wrap compiler synthesized nodes
(i.e. variables) to make it easier for diagnostic to diagnose precise
failure locations.
Consider the situation like:
```
protocol P {}
extension Array: P where Element: P {}
func test<T: P>() -> T {
$_a = ...
$_b = ...
return [$_a, $_b]
}
```
This is a common pattern with result builders.
In this case if one of the elements don't conform to `P` the best
user experience would be to attach diagnostic to the element otherwise
the developers would have to figure out where in result expression
the error occured before attempting to fix it.
2024-11-21 11:01:13 -08:00
Pavel Yaskevich
7151a9751a
[ASTDumper] Don't try to print opaque type decl substitutions
...
Attempting to dump opaque decl while type-checking a body of
the declaration it's associated with results in a request
cycle because underlying substitutions request would trigger
type-checking if the body isn't type-checked yet.
2024-11-21 09:37:59 -08:00
Allan Shortlidge
afad02e393
AST: Adopt AvailableAttr::isLanguageVersionSpecific().
2024-11-21 09:10:36 -08:00
Allan Shortlidge
2e03ba27e7
AST: Store Platform and PlatformAgnostic in AvailableAttr's bits.
2024-11-21 09:10:36 -08:00
Allan Shortlidge
36230cd9c6
AST: Use an accessor to get the PlatformKind from an AvailableAttr.
2024-11-21 09:10:36 -08:00
Allan Shortlidge
48f10f7dcf
AST: Centralize definition of future availability triple.
2024-11-20 10:08:45 -08:00
Allan Shortlidge
e881a443b7
AST: Upstream missing future availability range for visionOS.
2024-11-20 10:08:45 -08:00
Allan Shortlidge
b3f6421091
AST: Remove DeclAttributes::getPotentiallyUnavailable().
...
This utility duplicated logic that is now meant to be encapsulated by
`getUnsatisfiedAvailabilityConstraint()`.
2024-11-19 17:19:51 -08:00
Allan Shortlidge
c3f8352d5c
AST: Introduce AvailabilityContext::forDeploymentTarget().
2024-11-19 17:19:51 -08:00
Allan Shortlidge
6bf0e628be
AST: Rename AvailabilityContext::getDefault() to forInliningTarget().
...
Mirrors the factory methods on `AvailabilityRange`.
2024-11-19 17:19:51 -08:00
Nate Chandler
563f932a00
[NFC] Extracted predicate.
2024-11-19 15:52:24 -08:00
Nate Chandler
8eaae59c3b
[NFC] AST: Moved impl from Sema.
...
Now that the function is declared in AST, it should be implemented
there.
2024-11-19 15:52:24 -08:00
Andrew Trick
e4e07603b1
Merge pull request #77695 from atrick/handle_markdep
...
[NFC] mark_dependence handling for coroutines and accessors.
2024-11-19 10:22:25 -08:00
Andrew Trick
a0b21d5e5b
LifetimeDependence: broaden assert: allow trivial borrows.
...
During SIL parsing, allow `@``lifetime(borrow <argNum>)` on trivial arguments.
2024-11-18 22:02:44 -08:00
Meghana Gupta
5b5acc64e0
Promote Nonescapable types to a language feature
2024-11-18 18:09:17 -08:00
Meghana Gupta
ae28d667ff
Introduce LifetimeDependence experimental feature
2024-11-18 18:08:32 -08:00
Hamish Knight
4946c799af
[AST] Remove ModuleDecl::addFile
...
Rather than exposing an `addFile` member on
ModuleDecl, have the `create` members take a
lambda that populates the files for the module.
Once module construction has finished, the files
are immutable.
2024-11-17 14:17:20 +00:00
Slava Pestov
47156e006b
AST: Introduce ProtocolConformanceRef::forAbstract()
2024-11-16 16:16:06 -05:00
Slava Pestov
8d05362f89
AST: Simplify some lookupConformance() callers
2024-11-16 16:16:06 -05:00
Doug Gregor
c5de02f60e
Merge pull request #77628 from DougGregor/clang-importer-parse-request
...
[Clang importer] Use ParseSourceFileRequest for parsing swift_attr attributes
2024-11-16 01:12:27 -08:00
Slava Pestov
e3d2f75c52
Merge pull request #77632 from slavapestov/subst-map-verify
...
Flush out incorrectly-constructed substitution maps
2024-11-15 23:36:54 -05:00