arrow-kt / arrow

Λrrow - Functional companion to Kotlin's Standard Library
http://arrow-kt.io
Other
6.13k stars 442 forks source link

Fix isos and lenses generation in case of parameters having keywords as names. #3435

Closed lukasz-kusek closed 3 months ago

lukasz-kusek commented 3 months ago

Data classes which use parameters that have names which are Kotlin keywords and need to be escaped fail to compile:

data class LensData<T>(
    val `in`: T
) { companion object }

This change makes generation of isos an lenses work with such parameters.

There's an additional test added that requires some additional fix in the code which is outside of the scope of this change.

serras commented 3 months ago

@lukasz-kusek may I kindly ask to check whether prism generation also suffers from this problem? Since you already know the background, it might be easy to check all cases in one go.

lukasz-kusek commented 3 months ago

@lukasz-kusek may I kindly ask to check whether prism generation also suffers from this problem? Since you already know the background, it might be easy to check all cases in one go.

Sure. I think it doesn't suffer from the exact same problem, but thinking about it there might be similar one. Let me see.

lukasz-kusek commented 3 months ago

@lukasz-kusek may I kindly ask to check whether prism generation also suffers from this problem? Since you already know the background, it might be easy to check all cases in one go.

Sure. I think it doesn't suffer from the exact same problem, but thinking about it there might be similar one. Let me see.

As I expected it had that problem, but not for parameters only for subclass name.

lukasz-kusek commented 3 months ago

@serras Does this look ok now?

serras commented 3 months ago

Very nice, I was just waiting for the CI to kick in and check that everything passes. Merging now.

lukasz-kusek commented 3 months ago

@serras thanks

lukasz-kusek commented 3 months ago

@serras when's the next release planned for?