Slava Pestov
b911b80725
AST: Remove unused and incorrect BridgedASTType::subst()
2025-04-28 13:47:53 -04:00
Erik Eckstein
f7d81f7ac7
Swift SIL: deal with a generic self type in SubstitutionMap.getMethodSubstitutions
...
If the method is a default witness methods (`selfType` != nil) it has generic self type.
In this case the generic self parameter is at depth 0 and the actual generic parameters of the substitution map are at depth + 1, e.g:
```
@convention(witness_method: P) <τ_0_0><τ_1_0 where τ_0_0 : GenClass<τ_1_0>.T>
^ ^
self params of substitution map at depth + 1
```
2025-04-18 06:58:39 +02:00
Erik Eckstein
fd17b7e9f1
Swift AST: add GenericSignature.mapTypeIntoContext
2025-04-18 06:58:38 +02:00
Erik Eckstein
9aa61e127a
Swift AST: add some Type APIs
2025-04-18 06:58:38 +02:00
Erik Eckstein
2020897459
Swift AST: add some Decl APIs
...
* in `Decl`: `var parent: Decl?`
* in `ProtocolDecl`: `var requiresClass: Bool`
2025-04-18 06:58:38 +02:00
Erik Eckstein
1c9a7cd562
SwiftCompilerSources: refactor DiagnosticEngine
...
* move it from the SIL to the AST module (where it belongs)
* change the signature of `diagnose` from `diagnose(location, .some_error)` to `diagnose(.some_error, at: location)`
* add an overload to allow passing a `SIL.Location` directly to `diagnose`
* add a `Diagnostic : Error` utility struct which allows throwing a `Diagnostic`
2025-04-18 06:58:38 +02:00
Pavel Yaskevich
07ff063ae3
[AST/ASTGen/Sema/Serialization] Remove @execution attribute
...
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
2025-04-11 15:59:25 -07:00
Pavel Yaskevich
54b62ae983
[AST/Parse] Implement nonisolated(nonsending) type modifier
2025-04-11 15:59:25 -07:00
Pavel Yaskevich
b1ffa063b6
[AST/Sema] Intoduce nonisolated(nonsending) as a replacement for @execution(caller)
2025-04-11 15:57:11 -07:00
Pavel Yaskevich
4b8c8e7d72
[AST/Sema] Replace @execution(concurrent) with @concurrent
2025-04-11 12:08:29 -07:00
Meghana Gupta
ef1e94577f
Revert "Merge pull request #80540 from swiftlang/revert-80452-lifetimeinout"
...
This reverts commit 6eaa07a880 , reversing
changes made to e75ee3f4cf .
2025-04-04 09:50:13 -07:00
Artem Chikin
39e1791b67
Revert "Add support for inout lifetime dependence"
2025-04-04 09:00:09 -07:00
Meghana Gupta
d87a2b2ada
Rename ParsedLifetimeDependenceKind::Scope -> ParsedLifetimeDependenceKind::Borrow
2025-04-03 17:22:13 -07:00
Meghana Gupta
cfacd25df4
Add support for @lifetime(&arg)
2025-04-03 17:22:06 -07:00
Artem Chikin
66334f8f1b
Merge pull request #79290 from artemcm/ConstProtoSIL
...
[Compile Time Values] Implement a mandatory SIL pass to verify '@const' values
2025-04-01 00:12:27 -07:00
Doug Gregor
74fb36f9bc
Translate Fix-Its from the C++ diagnostics into swift-syntax diagnostics
...
The swift-syntax diagnostic formatter doesn't actually print Fix-Its,
but at least they're available now.
2025-03-28 13:20:57 -07:00
Artem Chikin
281f84da0f
[Compile Time Values] Rewrite the 'Diagnose Unknown Compile Time Values' diagnostic pass in Swift
2025-03-28 10:30:07 -07:00
Erik Eckstein
ac55dae26c
AST: add the possibility to compare SubstitutionMaps
2025-03-26 08:45:38 +01:00
Erik Eckstein
b39a6cdd22
AST: add var GenericSignature.genericParameters
2025-03-26 07:30:11 +01:00
Erik Eckstein
42bba8f484
AST: add some Declaration APIs
...
* `var Declaration.parentModule`
* `var AbstractFunctionDecl.isOverridden`
2025-03-26 07:30:11 +01:00
Erik Eckstein
d523e303c3
SIL/AST: move some SIL.Type APIs to the TypeProperties protocol which makes them also available for AST.Type and AST.CanonicalType
2025-03-26 07:30:10 +01:00
Hamish Knight
f8ab391737
Introduce type sugar for InlineArray ( #80087 )
...
* [CS] Decline to handle InlineArray in shrink
Previously we would try the contextual type `(<int>, <element>)`,
which is wrong. Given we want to eliminate shrink, let's just bail.
* [Sema] Sink `ValueMatchVisitor` into `applyUnboundGenericArguments`
Make sure it's called for sugar code paths too. Also let's just always
run it since it should be a pretty cheap check.
* [Sema] Diagnose passing integer to non-integer type parameter
This was previously missed, though would have been diagnosed later
as a requirement failure.
* [Parse] Split up `canParseType`
While here, address the FIXME in `canParseTypeSimpleOrComposition`
and only check to see if we can parse a type-simple, including
`each`, `some`, and `any` for better recovery.
* Introduce type sugar for InlineArray
Parse e.g `[3 x Int]` as type sugar for InlineArray. Gated behind
an experimental feature flag for now.
2025-03-23 15:31:37 -07:00
Rintaro Ishizaki
92a6fece48
[ASTGen] ObjC improvements
...
* Generate `#selector(...)` expression
* Generate `#keyPath(...)` expression
* Implicit `@objc` attribute for `@_objcImplementation` attribute
2025-03-20 05:04:58 -07:00
Slava Pestov
8bcd09aaa4
SIL: Preliminary refactoring of SILWitnessTable::AssociatedConformanceWitness
...
The Protocol field isn't really necessary, because the conformance
stores the protocol. But we do need the substituted subject type
of the requirement, just temporarily, until an abstract conformance
stores its own subject type too.
2025-03-18 19:38:42 -04:00
Rintaro Ishizaki
7add493002
[ASTGen] Generate '@_spi_available' attribute
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
607d122fe9
[ASTGen] Handle several missing syntax
...
* MissingExpr: Generate ErrorExpr with previous token location
* MissingType: Generate ErrorTypeRepr with previous token location
* MissingPattern: Generate implicit '_' pattern for recovery
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
ddd5b12661
[ASTGen] Handle trailing where clause in macro declarations
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
a2e40d6c31
[ASTGen] Generate @_typeEraser attribute
2025-03-16 15:18:59 -07:00
Rintaro Ishizaki
d1f892cbdc
[ASTGen] Generate '@reasync' and '@rethrows'
...
Also, fallback 'shouldBeRejectedByParser' attribute names to
'CustomAttr'.
2025-03-16 15:14:27 -07:00
Rintaro Ishizaki
9fc8bba26d
[ASTGen] Fix 'RawDocCommentAttr' generation
...
* Generate only when 'AttachCommentsToDecls' lang option is enabled.
* Fix the range.
2025-03-16 15:00:29 -07:00
Rintaro Ishizaki
c90768f36e
[ASTGen] Fix NamedOpaqueReturnTypeRepr
...
Generic parameter list was missing
2025-03-16 14:59:43 -07:00
Rintaro Ishizaki
bc668b6232
[ASTGen] Fix nullability
...
For 'arbitrary' macro names
2025-03-16 14:48:00 -07:00
Rintaro Ishizaki
996e72061a
[ASTGen] Gnerate PlaceholderTypeRepr
2025-03-16 14:38:32 -07:00
eeckstein
418bd2208d
Merge pull request #80013 from eeckstein/simplify-sil-type
...
AST/SIL: Refactor and cleanup `AST.Type`, `AST.CanonicalType` and `SIL.Type`
2025-03-14 18:10:25 +01:00
Erik Eckstein
d52f7d1619
AST/SIL: Refactor and simplify AST.Type, AST.CanonicalType and SIL.Type
...
* let `SIL.Type` conform to `TypeProperties` to share the implementation of common type properties between the AST types and `SIL.Type`
* call references to an `AST.Type` `rawType` (instead of just `type`)
* remove unneeded stuff
* add comments
2025-03-14 09:40:22 +01:00
Rintaro Ishizaki
ac80775201
[ASTGen] Generate miscellaneous builtin pound
...
`#error`, `#warning`, and `#assert`.
Also #_hasSymbol statement condition
2025-03-13 20:28:46 -07:00
eeckstein
ca76efabb4
Merge pull request #79908 from eeckstein/fix-witness-table-specialization
...
embedded: fix specialization of associated conformance entries in witness tables
2025-03-11 18:16:23 +01:00
eeckstein
19c51e2ae2
Merge pull request #79872 from WeZZard/bugfix/unchecked-ref-casting-with-optional-any-object
...
[SILOptimizer] Fixes the ValueDefUseWalker to handle potential unchecked_ref_cast between optional and non-optional class types.
2025-03-11 17:15:10 +01:00
Erik Eckstein
5212d92b57
Swift AST: add Conformance.getAssociatedConformance
2025-03-11 11:17:00 +01:00
Michael Gottesman
04bb69f426
Merge pull request #79727 from gottesmm/pr-025c1133954b74e7b4eda77e1a6f3bcafd4eb6cf
...
[concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
2025-03-10 22:35:00 -07:00
WeZZard
2237faca04
[SILOptimizer] Refines the implementation of of the bridged SILType for Swift.
2025-03-11 09:29:11 +08:00
Michael Gottesman
f64dd5a8d5
[concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
...
We introduce a new macro called #SwiftSettings that can be used in conjunction
with a new stdlib type called SwiftSetting to control the default isolation at
the file level. It overrides the current default isolation whether it is the
current nonisolated state or main actor (when -enable-experimental-feature
UnspecifiedMeansMainActorIsolated is set).
2025-03-10 17:33:45 -07:00
eeckstein
737b5ec924
Merge pull request #79674 from eeckstein/simplify-open-existential-metatype
...
Optimizer: Rework peephole optimizations to replace existential (archetypes) with concrete types
2025-03-10 08:18:52 +01:00
Rintaro Ishizaki
b6918a300a
Merge pull request #79843 from rintaro/astgen-misc
...
[ASTGen] Misc fixes
2025-03-07 16:58:44 -08:00
Rintaro Ishizaki
a506bae136
[ASTGen] Generate 'IsExpansionPattern' generic requirements
...
E.g. `where repeat each T: Comparable`
2025-03-07 10:28:47 -08:00
Rintaro Ishizaki
c669004e4c
[ASTGen] Clone expanded AvailabilitySpec to set macro location
2025-03-07 07:18:39 -08:00
Rintaro Ishizaki
0a56198879
[ASTGen] Remove BridgedAvailabilityDomain
2025-03-07 07:18:23 -08:00
Erik Eckstein
26c7310a9a
Swift AST: Fix debug description of Type
...
Don't get the swift source version string, but the debug dump string
2025-03-07 15:59:35 +01:00
Erik Eckstein
77dab77702
Swift SIL: make isLegalFormalType available in AST.Type
2025-03-07 15:59:34 +01:00
Erik Eckstein
431401c0dd
Swift AST: add an initializer to SubstitutionMap
...
And let it conform to `NoReflectionChildren` to make it's debug dump in lldb nicer
2025-03-07 15:59:34 +01:00