Commit Graph

172 Commits

Author SHA1 Message Date
Kabir Oberai 4148a6a7ff Support effectful properties 2023-04-11 23:17:51 +02:00
Kabir Oberai a71ba74df1 Fix generator crashing for property wrappers with empty type. 2023-04-01 10:19:13 +02:00
Seth Deckard 6f41152d83
Fix Generator to handle reserved keywords
Allows for reserved keywords to be used as argument labels / parameters
in mocked types.

Fixes: https://github.com/Brightify/Cuckoo/issues/452

- Moves escaping util function to Utils and makes it internal since it
  now needs to be used outside of `Generator`.
- Uses escaping function in areas affected by the bug.
- Renames set of reserved names to reflect the larger scope (no longer
  used for just function names).
- Some minor clean-up to style and formatting on areas touched.

Example of the problem:

Generate a mock for a protocol with the function:

```
func escape(for: String) -> String
```

This would result in `for` as a function parameter used within the body
of the function for the mock and verification and stubbing proxies,
which would not compile. This change escapes keywords like this so the
generated code will compile.

See `TestedProtocol.withReservedKeywords` for a test example. An example
was added to `TestedClass` as well, but the real motivation for this is
protocols since conforming types can and often do use a different
parameter name so the argument label like `for` would never be used
within the body of the function.
2023-03-23 08:31:12 -04:00
David Steinacher f0f77397a5 add missing () when closure is an autoclosure 2023-02-12 16:30:21 +01:00
Matyáš Kříž 835c61246a Completely convert project to Tuist. 2023-01-07 18:58:48 +01:00
Farid Mammadov cbb5f5d416 Add support async/await in Protocol with Associated Type. 2023-01-03 16:46:43 +01:00
sk409 8d7b893bc2 Support NSObjectProtocol inheritance for protocol. 2022-09-19 17:39:55 +02:00
sk409 5a9301b97c Remove closure argument name. 2022-09-01 17:00:52 +02:00
Yoji Ueda 0ff327d675 Remove unnecessary await expression in MockTemplate. 2022-08-16 16:42:21 +02:00
Roland Kakonyi 1b0af7cc4a Fix missing attributes for Stubs. 2022-07-24 16:14:15 +02:00
Tyler Thompson 5d52a7f75b Add support for nested classes. 2022-06-17 19:06:07 +02:00
sk409 3f6e9a84e8 Add support for multiline method signatures. 2022-06-17 18:23:07 +02:00
Roland Kakonyi a3c4ad13f7 Add support for unavailable platforms from available attributes. 2022-06-17 17:49:03 +02:00
Matyáš Kříž 6af1b4d09f Remove duplicate attributes. 2022-05-30 20:28:33 +02:00
Matyáš Kříž dd8db792ba Don't require a name range for method parameters. 2022-03-17 18:40:48 +01:00
sk409 b1da946216 Ignore missing input paths. 2022-02-23 20:53:08 +01:00
sk409 2775830d13 Escape reserved keywords. 2022-02-13 17:46:04 +01:00
Ailton Vieira Pinto Filho 53b8ff4428 Add support for concurrency mocking. 2022-01-18 19:37:21 +01:00
Matyáš Kříž 6c6c7fa83c Update PathKit, Spectre, Stencil. 2021-11-29 13:29:29 +01:00
Akihiro Sakahara eb1502c657 Bump Stencil version to 0.14.2. 2021-11-18 17:10:30 +01:00
Matyáš Kříž a0a7c82526 Sidestep `SourceKitten`'s off-by-one bug when parsing generic parameter inheritance. 2020-06-28 16:45:16 +02:00
Matyáš Kříž e2bb73412f Fix incorrect `where` clause parsing. 2020-06-28 16:44:48 +02:00
Matyáš Kříž b3bec5f8ff Clean up project. 2020-06-28 16:43:22 +02:00
Matyáš Kříž b1c7c77dbb Fix type equality check to rule out whitespace inconsistencies. 2020-04-01 15:07:13 +02:00
dependabot[bot] 491ff8dff8 Bump ffi from 1.9.10 to 1.9.25 in /Generator/Tests
Bumps [ffi](https://github.com/ffi/ffi) from 1.9.10 to 1.9.25.
- [Release notes](https://github.com/ffi/ffi/releases)
- [Changelog](https://github.com/ffi/ffi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ffi/ffi/compare/1.9.10...1.9.25)

Signed-off-by: dependabot[bot] <support@github.com>
2020-02-20 21:07:47 +01:00
Tadeas Kriz fb9e2ea421 Fix compilation issue introduced by a wrong merge. 2020-02-20 21:05:29 +01:00
Tadeas Kriz 619d8c73dd Adjust accessibility to match enclosing container. 2020-02-20 21:05:29 +01:00
Matyáš Kříž ed1e947e1f Improve code stylistically. 2019-11-06 13:45:16 +01:00
Matyáš Kříž 44dedd3859 Improve code stylistically. 2019-11-05 16:00:49 +01:00
Pubbus 808a19f920 Code cleaning 2019-11-05 16:00:49 +01:00
Pubbus fc91ef5e1c Refactor and fix closure return type matcher 2019-11-05 16:00:49 +01:00
Pubbus 69facb06bb Fix closure generation, return type is required in `withoutActuallyEscaping` from swift 5.1 (XCode11) 2019-11-05 16:00:49 +01:00
Matyáš Kříž f10f174357 Add macOS target for CI testing. 2019-09-11 11:43:41 +02:00
Matyáš Kříž 9947868805 Add container accessibility to appropriate places in templates. 2019-07-30 16:18:39 +02:00
Matyáš Kříž 39257d9cc8 Add initial implementation of a type guesser. 2019-07-22 13:10:48 +02:00
Matyáš Kříž e405dbfe0a Copy protocol's accessibility to the implementation caller class. 2019-07-22 13:09:53 +02:00
Matyáš Kříž 86432954a9 Revert accessibility inheritance. 2019-07-22 13:09:53 +02:00
Matyáš Kříž b3fd0dacfd Some more cleaning along with one more compile test case. 2019-05-29 20:06:10 +02:00
Matyáš Kříž fe3af6709e Clean up and fix a bug where adding a private name to a function made it generate twice and fail the compilation. 2019-05-29 19:44:49 +02:00
Matyáš Kříž 694bd9c8be Fix generic protocol generation and type erasure with multiple methods of same name. 2019-05-26 15:37:40 +02:00
Matyáš Kříž d69bcd5bdd Fix a bug concerning empty public name methods with no private ones. 2019-05-26 15:36:12 +02:00
Matyáš Kříž 922889ca32 Remove redundant optional classes. 2019-05-16 19:10:40 +02:00
Matyáš Kříž e16fb3a383 Add support for optional read only properties. 2019-05-16 18:51:03 +02:00
Matyáš Kříž 7a41a928fc Fix some `run` script bugs. 2019-05-16 13:29:44 +02:00
Matyáš Kříž b4c2bbe5b7 Fix incorrect test and simplify two ternary operators. 2019-05-15 17:48:16 +02:00
Matyáš Kříž 449b71e3db Fix `any()` not working anymore by itself with optional parameters in functions. 2019-05-15 17:44:34 +02:00
Matyáš Kříž 083a6b5c17 Add support for rethrowing functions. 2019-05-14 17:39:15 +02:00
Davide Mazzoni 1b71fcfd2e Add property attributes to stubs and proxies 2019-05-14 14:54:51 +02:00
Matyáš Kříž 2305ec2221 Add necessary types and fix errors. 2019-05-14 14:53:42 +02:00
Matyáš Kříž ec41a4ff97 Add a test class with generic methods to be generated. 2019-05-14 14:07:54 +02:00