Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: added support for generics #5

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open

WIP: added support for generics #5

wants to merge 61 commits into from

Conversation

i582
Copy link
Contributor

@i582 i582 commented Mar 14, 2022

Generics support

At the moment, new generics are being developed in KPHP, which will become much more convenient and will also be applicable to classes, which will make developing in KPHP more convenient and safer.

However, when it comes to generic support in PhpStorm, we see a sad picture, the current support does not suit us and we want to have full control over the syntax and features of generics.

It is also worth considering that without support in the IDE, generics in KPHP will not be super convenient, any development with them will be accompanied by inconveniences, since the IDE simply will not understand them.

For example, if the IDE does not know that there is a link to the class in the comments or in the phpdoc, then when renaming, we will get an invalid link due to which KPHP will not be able to compile the code.

Therefore, we decided to try to make our own implementation and this PR for the moment adds initial support for generics for functions. Adding support for classes is planned for later, when issues with generics for functions are resolved.

Description of generics will be added a bit later.

@i582 i582 added the enhancement New feature or request label Mar 14, 2022
@i582 i582 force-pushed the pmakhnev/generic branch from 7c0e27a to c01af26 Compare March 14, 2022 16:00
@i582 i582 force-pushed the pmakhnev/generic branch from b9d8923 to 87ce1f2 Compare March 27, 2022 22:29
i582 added 7 commits March 28, 2022 05:56
…ject language

- Added intention to collapse generics instantiation comments
- IDE version has been updated to 2022.1.1, as there is a bug in 2022.1 due to which KphpStormASTFactory does not work
@i582 i582 force-pushed the pmakhnev/generic branch from 265dd9e to afc47aa Compare May 26, 2022 01:51
@i582 i582 added the generics Everything related to generics label May 26, 2022
i582 added 9 commits May 30, 2022 07:07
- fixed type compatibility for a callable and a typed callable
- fixed default types handling
- improved handling for union instantiations for methods and fields
- generic hint now contains only "<T>"
- fixed InstantiationParamsCount inspection
- fixed callable and string type compatibility
- fixed support for new 2022.2 int<X,Y> type
- fixed cases with any
- added KPHP tests
@i582 i582 force-pushed the pmakhnev/generic branch from ce65366 to 02dc6a7 Compare June 7, 2022 11:38
@i582 i582 force-pushed the pmakhnev/generic branch from 65d2c79 to f7b998d Compare June 10, 2022 15:00
- added more comments
@i582 i582 force-pushed the pmakhnev/generic branch from 37c23db to cbc91b1 Compare June 12, 2022 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request generics Everything related to generics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant