Commit Graph

1293 Commits

Author SHA1 Message Date
Erik Eckstein
d225c47d25 AST: rename OpenArchetypeType -> ExistentialArchetypeType
NFC
2025-03-11 20:21:46 +01:00
Rintaro Ishizaki
accd108e4a Merge pull request #79857 from rintaro/retire-pound-diagnostics-decl
[Parse/AST] Remove PoundDiagnosticDecl
2025-03-09 21:23:16 -07:00
Rintaro Ishizaki
5eac58e1e0 [AST] SwitchStmt only hold CaseStmt
Now that there is no way SwitchStmt to hold AST nodes other than
CaseStmt.
2025-03-08 09:14:40 -08:00
Rintaro Ishizaki
002d7d7cdf [Parse/AST] Remove PoundDiagnosticDecl
There is no reson to make a AST node for '#error' and '#warning'
directives. Parser knows the diagnostics should be emitted or not.
2025-03-07 21:48:01 -08:00
Rintaro Ishizaki
d60f1986a8 [ASTGen] Adopt AvailabilityDomainOrIdentifier scheme
Aligning with libParse
2025-03-07 04:14:50 -08:00
Artem Chikin
13a8d4b88e [Compile Time Values] Add a new experimental feature and the parsing of the '@const' attribute 2025-03-04 07:30:57 -08:00
Artem Chikin
de26e960e2 Rename '_const' attribute to 'CompileTimeLiteral'
To pave the way for the new experimental feature which will operate on '@const' attribute and expand the scope of what's currently handled by '_const' without breaking compatibility, for now.
2025-03-04 07:30:02 -08:00
Allan Shortlidge
8ebf2aa7e6 AST: Add printing utilities for AvailabilityDomain and AvailabilitySpec. 2025-02-25 19:45:39 -08:00
Rintaro Ishizaki
af489ea32b Merge pull request #79544 from rintaro/astgen-small-fixes 2025-02-24 07:25:42 -08:00
Allan Shortlidge
eb6506a1ad AST: Introduce SemanticAvailabilitySpec.
It wraps an type-checked `AvailabilitySpec`, which guarantees that the spec has
a valid `AvailabilityDomain` associated with it. This will unblock moving
AvailabilitySpec domain resolution from parsing to sema.
2025-02-23 10:53:06 -08:00
Rintaro Ishizaki
efea164d04 [ASTGen] Generate from 'MissingTypeSyntax'
Just emit ErrorTypeRepr
2025-02-21 11:36:29 -08:00
Rintaro Ishizaki
f48282c92b [ASTGen] Generate trailing where clause for SubscriptDecl
It was just missing.
2025-02-21 11:36:29 -08:00
Allan Shortlidge
04024ec222 AST: Simplify printing of AvailabilitySpecs in ASTDumper. 2025-02-18 21:31:48 -08:00
Rintaro Ishizaki
94402b6c9d [ASTGen] Generate LifetimeAttr 2025-02-17 08:56:29 -08:00
Rintaro Ishizaki
6184367492 [Parse] Post-process parsed AST to register decls with opaque result
Move the logic out of `Paser` so `ASTGen` can use it.
2025-02-14 18:51:22 -08:00
Rintaro Ishizaki
214315b1cc [ASTGen] Generate several type attributes
Also rework existing type attribute generate functino to use standard
attribute generation facilities.
2025-02-14 18:18:24 -08:00
Allan Shortlidge
06030d66aa AST: Introduce AvailabilityDomainOrIdentifier.
It provides a common way to represent either a parsed domain identifier or the
resolved domain.

NFC.
2025-02-13 21:18:05 -08:00
Rintaro Ishizaki
e066bb266b Merge pull request #79355 from rintaro/astgen-toplevelvardecl
[ASTGen] Generate PatternBindingDecl at top level
2025-02-13 09:43:10 -08:00
Rintaro Ishizaki
73164a0ffd Merge pull request #79353 from rintaro/astgen-magic-ident-literal
[ASTGen] Generate MagicIdentifierLiteralExpr
2025-02-13 06:25:09 -08:00
Allan Shortlidge
1d509c7120 Merge pull request #79354 from tshortli/retire-availability-spec-subclasses
AST: Retire subclasses of `AvailabilitySpec`
2025-02-13 03:59:44 -08:00
Rintaro Ishizaki
153421f816 Merge pull request #79311 from rintaro/dump-declcontext
[ASTDumper] Dump DeclContext
2025-02-13 03:30:49 -08:00
Rintaro Ishizaki
6ea6a31ec7 [ASTGen] Generate TopLevelCodeDecl for PatternBindingDecl
* Instead of hoisting VarDecl in the bridging functions, do it in
  ASTGen.
* Introduce `Decl::forEachDeclToHoist` to handle VarDecls in
  PatternBindingDecl, and EnumElementDecl in EnumCaseDecl.
* Intorduce `withBridgedSwiftClosure(closure:call:)` as a callback
  mechanism between Swift and C++
* In `generate(sourceFile:)`, instead of using `generate(codeBlockItem:)`
  handle `CodeBlockItemSyntax.Item` manually to handle `TLCD` wrapping
  and `VarDecl` hoisting.
* Make `generate(variableDecl:)` handle TLCD correctly.
2025-02-13 00:09:22 -08:00
Rintaro Ishizaki
563ddc47e2 [AST] Eliminate 'SYNTAX_KIND' from MagicIdentifierKinds.def
Nothing is using it.
2025-02-12 23:19:34 -08:00
Allan Shortlidge
670084a9ac AST: Retire PlatformVersionConstraintAvailabilitySpec. 2025-02-12 22:46:58 -08:00
Allan Shortlidge
0722efe97e AST: Retire PlatformAgnosticVersionConstraintAvailabilitySpec. 2025-02-12 20:41:00 -08:00
Allan Shortlidge
6844cfe714 AST: Retire OtherPlatformAvailabilitySpec. 2025-02-12 19:39:30 -08:00
Rintaro Ishizaki
71b24665fa [ASTDumper] Dump DeclContext
* Include `DeclContext` of the node where possible
* Add 'default-with-decl-contexts' dump style that dumps the dect context
  hierarchy in addition to the AST
* Support `-dump-parse` with `-dump-ast-format json`
2025-02-12 10:53:33 -08:00
Allan Shortlidge
09f8622b1b AST: Simplify AvailabilitySpec subclasses further.
Remove methods that are specific to AvailabilitySpec subclasses and replace
them with methods on the superclass if necessary.

NFC.
2025-02-11 22:45:43 -08:00
Allan Shortlidge
6daea78ccf AST: Remove AvailabilitySpec.h include from Stmt.h.
Include it where it's actually used instead to improve compile times.
2025-02-11 20:03:01 -08:00
Tony Allevato
4e3e91e3b2 Merge pull request #79218 from allevato/json-ast-inherited
[ASTDumper] Write inherited types correctly.
2025-02-09 20:18:24 -08:00
Tony Allevato
5ff6286dd3 [ASTDumper] Write inherited types correctly.
ASTDumper was never updated to print extra conformance information,
like suppression, preconcurrency, etc. In default mode, we print it
as a comma-delimited list of source-like strings. In JSON mode, we
print objects containing flags.
2025-02-07 10:05:40 -08:00
Michael Gottesman
7e350bb4ce Revert "[concurrency] Add Concurrent/ConcurrentUnsafe and use it instead of ActorIsolation::Nonisolated."
This reverts commit 0cb64638d0.
2025-02-06 14:05:06 -08:00
Michael Gottesman
f05f08c2c0 Revert "[concurrency] Make ActorIsolation::Nonisolated -> CallerIsolationInheriting and delete CallerIsolationInheriting."
This reverts commit 543b1e6ca3.
2025-02-06 14:04:30 -08:00
Anton Korobeynikov
1e7a1d91fc Emit reabstraction thunks for implicit conversions between T.TangentType and Optional<T>.TangentType (#78076) 2025-02-05 20:57:52 -08:00
Rintaro Ishizaki
df2ada37df [ASTGen] Generate AvailableAttr
* Move `AvailabilitySpec` handling logic to AST, so they can be shared
  between libParse and ASTGen
* Requestify '-define-availability' arguments parsing and parse them
  with 'SwiftParser' according to the 'ParserASTGen' feature flag
* Implement 'AvailableAttr' generation in ASTGen
2025-02-04 23:40:01 -08:00
Tony Allevato
c5f0200680 Merge pull request #79059 from allevato/json-ast-followups
[ASTDumper] Some followups from the initial JSON PR and macro dumping improvements.
2025-02-04 01:13:46 -05:00
Michael Gottesman
543b1e6ca3 [concurrency] Make ActorIsolation::Nonisolated -> CallerIsolationInheriting and delete CallerIsolationInheriting. 2025-02-03 10:56:08 -08:00
Michael Gottesman
0cb64638d0 [concurrency] Add Concurrent/ConcurrentUnsafe and use it instead of ActorIsolation::Nonisolated.
This is just the first part of a larger transition.
2025-02-03 10:56:06 -08:00
Tony Allevato
0d9467e688 Hoist ASTDumpMemberLoading choice up to the frontend call sites. 2025-02-03 11:37:47 -05:00
Tony Allevato
237e79a467 Print the macro's concrete decl ref for any macro expansions.
This gives us the macro's USR, letting us match it up to its
declaration elsewhere.
2025-01-31 11:15:02 -05:00
Anthony Latsis
a84dfc8387 [Gardening] Fix some set but not used variables 2025-01-30 21:34:38 +00:00
Tony Allevato
9d3bcca73f Ensure that top-level macro expansions are in the JSON AST dump. 2025-01-30 12:18:21 -05:00
Tony Allevato
3804110db8 Change parseIfNeeded to an enum to control member loading behavior. 2025-01-30 09:10:15 -05:00
Tony Allevato
5fe10ce86a ASTDumper: Label "interface type" -> "interface_type". 2025-01-29 13:55:00 -05:00
Doug Gregor
9af4d6eb65 Merge pull request #78730 from DougGregor/safe-attr
Introduce the @safe attribute as described in the opt-in safety checking proposal
2025-01-24 19:42:52 -08:00
Tony Allevato
d2fd3479da Additional post-review fixes. 2025-01-24 14:11:20 -05:00
Doug Gregor
4395537fa0 Introduce the @safe attribute as described in the opt-in safety checking proposal 2025-01-23 07:47:17 -08:00
Tony Allevato
f249db3f85 Use cached evaluator results when looking up function types.
Also improve the output for thrown error destinations in
parsable modes.
2025-01-22 14:26:14 -05:00
Tony Allevato
8df48e52ff Address more reviewer feedback. 2025-01-22 14:26:14 -05:00
Tony Allevato
87cabb0f04 Print the buffer ID for non-main buffers and test via macro expansions. 2025-01-22 14:26:13 -05:00