Commit Graph

89 Commits

Author SHA1 Message Date
Erik Eckstein
0a8c60290f AST: add Type.interfaceTypeOfArchetype and some related APIs 2025-08-26 16:38:19 +02:00
Erik Eckstein
0a953b60ca SIL/AST: add var InjectEnumAddrInst.element and var EnumElementDecl.hasAssociatedValues 2025-08-03 11:06:15 +02:00
Anthony Latsis
5620abbad8 Bridging: Bridge swift::CharSourceRange directly 2025-07-15 21:34:48 +01:00
Anthony Latsis
6eb5d7d857 Bridging: Bridge swift::SourceLoc directly 2025-07-15 21:33:06 +01:00
Anthony Latsis
8cbf5a26e4 Bridging: Bridge swift::DeclBaseName directly 2025-07-10 17:58:13 +01:00
Anthony Latsis
0e0fbc4160 Bridging: Bridge swift::Identifier directly 2025-07-10 17:58:13 +01:00
eeckstein
1d3895610e Merge pull request #82349 from eeckstein/alloc-box-to-stack
Optimizer: re-implement and improve the AllocBoxToStack pass
2025-06-21 07:28:18 +02:00
Anthony Latsis
b347aedeb0 ASTBridging: Encapsulate some operations on BridgedLayoutConstraint
NB: Switching from factory methods to initializers as well crashes on
Windows.
2025-06-20 16:44:49 +01:00
Erik Eckstein
1f304e5609 SIL: improve APIs for Box types
* move `isBox` from `SIL.Type` to `TypeProperties` to make it also available for AST types
* add `BoxFieldsArray.isMutable(fieldIndex:)`
2025-06-20 08:14:59 +02:00
Anthony Latsis
7de8827169 BasicBridging: Turn BridgedOptional into a macro 2025-06-19 18:11:38 +01:00
Anthony Latsis
106d5f4461 {AST,Basic}Bridging: Use SWIFT_COMPUTED_PROPERTY 2025-06-16 19:11:32 +01:00
Erik Eckstein
28985f4d41 Swift AST: add var EnumDecl.hasRawType 2025-05-29 08:12:17 +02:00
Erik Eckstein
dbd0af063c AST: add some BuiltinFixedArray and IntegerType APIs 2025-05-15 21:29:02 +02:00
Erik Eckstein
ff2341e83a Swift AST/SIL: add Type APIs for Builtin.FixedArray
* `Type.isBuiltinFixedArray`
* `Type.builtinFixedArrayElementType`
2025-05-12 19:24:31 +02:00
Erik Eckstein
aacb4d458f Swift AST: add Type.hasDynamicSelf 2025-05-08 19:21:08 +02:00
Meghana Gupta
5395721a20 Bridge getSwiftMutableSpanDecl() and isBuiltinType() 2025-04-30 13:40:12 -07:00
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
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
Doug Gregor
731f58443c Address review feedback on AbstractConformance in ProtocolConformanceRef 2025-03-23 20:54:39 -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
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
Erik Eckstein
d225c47d25 AST: rename OpenArchetypeType -> ExistentialArchetypeType
NFC
2025-03-11 20:21:46 +01: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
Erik Eckstein
5212d92b57 Swift AST: add Conformance.getAssociatedConformance 2025-03-11 11:17:00 +01:00
WeZZard
2237faca04 [SILOptimizer] Refines the implementation of of the bridged SILType for Swift. 2025-03-11 09:29:11 +08: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
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
67925ea27e Swift AST: add GenericSignature
and add `var Type.invocationGenericSignatureOfFunctionType`
2025-03-07 15:59:34 +01:00
Erik Eckstein
810064b7dc Cleanup and additions to AST and SIL Type/CanonicalType
* factor out common methods of AST Type/CanonicalType into a `TypeProperties` protocol.
* add more APIs to AST Type/CanoncialType.
* move `MetatypeRepresentation` from SIL.Type to AST.Type and implement it with a swift enum.
* let `Builder.createMetatype` get a CanonicalType as instance type, because the instance type must not be a lowered type.
2025-03-07 15:59:33 +01:00
Erik Eckstein
eadfbf6842 Swift AST: add some APIs to Type and CanonicalType 2025-03-07 15:59:33 +01:00
Rintaro Ishizaki
d60f1986a8 [ASTGen] Adopt AvailabilityDomainOrIdentifier scheme
Aligning with libParse
2025-03-07 04:14:50 -08:00
Rintaro Ishizaki
4160f101ad [ASTGen] Generate @_unavailableInEmbedded attribute
Which is a sugar of '@available(*, unavailable)' when Embedded feature
is enabled.
2025-02-21 16:54:09 -08:00
Rintaro Ishizaki
8833ff58a2 [AST] Sink the flag collection logic from Parse to AST
* Collect flag in `ParamDecl::setTypeRepr()`.

* [ASTGen] Separate `BridgedParamDecl.setTypeRepr(_:)` from
`BridgedParamDecl.createParsed(_:)` aligning with C++ API. The majority
of the creations don't set the typerepr.

* Update `ParamSpecifierRequest::evaluate` to handle non-implicit
`ParamDecl` without `TypeRepr` (i.e. untyped closure parameter), instead
of `setSpecifier(::Default)` manually in Parse.
2025-02-20 10:04:49 -08:00
Rintaro Ishizaki
2b14a233b7 [ASTGen] Generate generic layout constraint 2025-02-19 16:38:00 -08:00
Rintaro Ishizaki
d109a86bb7 [ASTGen] Generate CustomAttr on types
Rework TypeAttribute bridging facilities.
Eliminate the _fake_ `swift::TypeAttributes`, but just use the normal
`BridgedArrayRef` for briding the attribute list. Introduce
`BridgedTypeOrCustomAttr` tagged pointer which resembles
`swift::TypeOrCustomAttr`.
2025-02-18 13:08:50 -08:00
Rintaro Ishizaki
57b6d1e90b [ASTGen] Generate "minus" number literal expression 2025-02-17 21:34:11 -08:00
Rintaro Ishizaki
6d85bb58c5 Merge pull request #79412 from rintaro/astgen-typeattrs
[ASTGen] Generate OpaqueReturnTypeOfTypeAttr
2025-02-16 13:55:39 -08:00
Rintaro Ishizaki
84875d147e [ASTGen] Bridge ASTContext.Id_x 2025-02-16 05:22:46 -08:00
Rintaro Ishizaki
0ced6e06b4 [ASTGen] Generate CaptureListExpr
Move the capture list entry construction logic to
CaptureListEntry::createParsed() so that ASTGen can use it.
2025-02-16 05:22:46 -08:00