Commit Graph

37 Commits

Author SHA1 Message Date
Paolo Tranquilli
1f356078ff Swift: temporarily accept test changes 2024-10-31 15:57:31 +01:00
Paolo Tranquilli
0243d9f2b9 Swift: accept explicit any in existential type name 2024-03-27 13:49:15 +01:00
Alex Denisov
e865c3cbd3 Swift: extract parameter packs 2023-11-10 10:20:14 +01:00
Alex Denisov
ea5eda0f22 Swift: adjust test expectations 2023-06-27 17:21:56 +02:00
Paolo Tranquilli
63fb0581c2 Swift: accept inconsistencies for now 2023-05-24 20:09:46 +02:00
Nora Dimitrijević
91a151ec2a Swift: update tests 2023-04-26 15:47:20 +02:00
Alexandre Boulgakov
35a2d55d18 Swift: Extract structured keypath components.
Changes in swift/ql/lib are generated by swift/codegen without manual intervention.
2023-04-11 13:34:17 +01:00
Nora Dimitrijević
f3ebb6e03b Swift: MethodLookupExpr.getMethodRef() [codegen'd]
This refactors SelfApplyExpr.getFunction() as MethodLookupExpr().getMethodRef().

This is simpler, because we are not hiding DeclRefExprs or reinventing hidden AST resolution.
2022-12-20 23:09:02 -05:00
Nora Dimitrijević
6a0b020573 Swift: move methodlookup test to library-tests 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
15d5674d12 Swift: update .expected files based on last commit 2022-12-14 14:28:00 -05:00
Nora Dimitrijević
f6d5e8db5f Swift: update test .expected files 2022-12-14 14:27:59 -05:00
Nora Dimitrijević
1ede851cf5 Swift: initial getStaticTarget test 2022-12-14 14:22:53 -05:00
Nora Dimitrijević
99719d0ee1 Swift: initial PrintAst test for Method Lookups 2022-12-14 14:22:53 -05:00
Tony Torralba
4411852e59 Add BitwiseOperation.qll 2022-11-08 11:33:10 +01:00
Paolo Tranquilli
072edad0fd Swift: accept new test changes 2022-11-08 09:30:25 +01:00
Paolo Tranquilli
21adcca065 Swift: add bitwise ops to PrintAst test 2022-11-08 08:53:36 +01:00
Paolo Tranquilli
742cf0a593 Swift: hide orphaned DeclRefExpr nodes 2022-08-31 08:35:00 +02:00
Paolo Tranquilli
38d65d3fae Swift: make ConstructorDecl's name include params
In order to distinguish overloads of the constructor and for consistency
with other function calls, `ConstructorDecl` string representation uses
the name which includes parentheses and parameter labels.

For consistency also the destructor got the same change, which means
all `DestructorDecl`s will now show as `deinit()` rather than `deinit`.
2022-08-30 11:11:50 +02:00
Paolo Tranquilli
6706ba6ded Swift: accept toString changes in tests 2022-08-19 15:22:02 +02:00
Paolo Tranquilli
9b50336e47 Swift: synthesize MethodRefExpr
This introduces a `MethodRefExpr` node synthesized out of
`DotSyntaxCallExpr` under the `LookupExpr` hierarchy. This means that
much like
```free_function(1, 2)```
is a `CallExpr` with `getFunction` giving a `DeclRefExpr`,
```foo.method(1, 2)```
is now a `CallExpr` with `getFunction` giving a `MethodRefExpr`.

`ApplyExpr::getStaticTarget` has been made work with it (as well as
`ConstructorRefCallExpr` which for the moment has been left where it
is), a new `MethodApplyExpr` has been introduced deriving from it,
and control and data flow libraries have adapted.

A small but was fixed in `qlgen` where the default constructor for DB
types was not correctly subtracting derived IPA types depending on the
order of definitions in `schema.yml`.

There are still some occurrences of `DotSyntaxCallExpr`, and as already
mentioned the other `SelfApply` class (`ConstructorRefCallExpr`) was
left alone. Their treatment is left for a future PR.
2022-08-19 14:48:36 +02:00
Paolo Tranquilli
033b239b22 Swift: collapse TypeRepr hierarchy
Now `TypeRepr` is a final class in the AST, which is more or less just
a type with a location in code.

As the frontend does not provide a direct way to get a type from a
type representation, this information must be provided when fetching
the label of a type repr.

This meant:
* removing the type repr field from `EnumIsCaseExpr`: this is a virtual
  AST node introduced in place of some kinds of `IsEpxr`. The type
  repr is still available from the `ConditionalCheckedCastExpr` wrapped
  by this virtual node, and we will rebuild the original `IsExpr` with
  the IPA layer.
* some logic to get the type of keypath roots has been added to
  `KeyPathExpr`. This was done to keep the `TypeRepr` to `Type` relation
  total in the DB, but goes against the design of a dumb extractor. The
  logic could be moved to QL in the future
* in the control flow library, `TypeRepr` children are now ignored. As
  far as I can tell, there is no runtime evaluation going on in
  `TypeRepr`s, so it does not make much sense to have control flow
  through them.
2022-07-12 10:49:14 +02:00
Paolo Tranquilli
e25f22da26 Merge main into redsun82/swift-extraction 2022-06-22 16:54:52 +02:00
Paolo Tranquilli
1fc2bc4938 Swift: really fix tests 2022-06-22 16:15:02 +02:00
Paolo Tranquilli
3ed783df7f Swift: fix tests 2022-06-22 12:14:47 +02:00
Mathias Vorreiter Pedersen
e2478d1106 Swift: 'getStaticCallTarget' should also return things like 'ConstructorDecl's. 2022-06-21 09:35:56 +01:00
Mathias Vorreiter Pedersen
c049988116 Swift: Accept test changes. 2022-06-20 14:57:16 +01:00
Mathias Vorreiter Pedersen
12d27ec580 Swift: Modify 'toString' in 'OtherConstructorDeclRefExpr' to properly reflect that it's a reference and not a call. 2022-06-20 09:59:23 +01:00
Alex Denisov
311dcfa230 Swift: remove toString from UnknownElement
Another attempt to remove flakiness
2022-06-14 13:37:17 +02:00
Alex Denisov
9681358a6d Swift: extract OtherConstructorDeclRefExpr 2022-06-14 12:53:25 +02:00
Alex Denisov
1dab01a31c Swift: fix ctor/dtor names in toString 2022-06-02 08:28:46 +02:00
Mathias Vorreiter Pedersen
9175354bbd Swift: Add test and accept changes. 2022-05-30 15:51:49 +01:00
Mathias Vorreiter Pedersen
f17afa8a11 Swift: Accept test changes. 2022-05-25 16:01:42 +01:00
Mathias Vorreiter Pedersen
21641eb1cd Swift: Make the 'semantics.ql' test plantform-independent. 2022-05-24 10:00:14 +01:00
Mathias Vorreiter Pedersen
a0659072b5 Swift: Add tests and accept test changes. 2022-05-24 09:00:34 +01:00
Paolo Tranquilli
e6f2ab003c Swift: remove empty DB-CHECK.expected files 2022-05-20 16:01:56 +02:00
Paolo Tranquilli
553930d9e3 Swift: type visitor
This transfers the current state of `TypeVisitor` from the
proof-of-concept.
2022-05-20 15:42:20 +02:00
Paolo Tranquilli
922608c65a Swift: expression visitor
This transfers the current status of `ExprVisitor` from the
proof-of-concept, together with some changes required for swift 5.6.
2022-05-20 15:41:27 +02:00