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

KSP Optics plugin does not consider imports #2618

Closed
Quantum64 opened this issue Dec 28, 2021 · 0 comments · Fixed by #2678
Closed

KSP Optics plugin does not consider imports #2618

Quantum64 opened this issue Dec 28, 2021 · 0 comments · Fixed by #2678

Comments

@Quantum64
Copy link

The following does not compile:

import arrow.optics.optics
import kotlin.time.Duration

@optics
data class OpticsTest(
    val time: Duration
) {
    companion object
}

because the generated code lacks the required kotlin.time.Duration import:

import arrow.core.left
import arrow.core.right
import arrow.core.toOption

inline val OpticsTest.Companion.iso: arrow.optics.Iso<OpticsTest, Duration> inline get()= arrow.optics.Iso(
  get = { opticsTest: OpticsTest -> opticsTest.time },
  reverseGet = { OpticsTest(it) }
)

inline val OpticsTest.Companion.time: arrow.optics.Lens<OpticsTest, Duration> inline get()= arrow.optics.Lens(
  get = { opticsTest: OpticsTest -> opticsTest.`time` },
  set = { opticsTest: OpticsTest, value: Duration -> opticsTest.copy(`time` = value) }
)



inline val <S> arrow.optics.Iso<S, OpticsTest>.time: arrow.optics.Lens<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Lens<S, OpticsTest>.time: arrow.optics.Lens<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Optional<S, OpticsTest>.time: arrow.optics.Optional<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Prism<S, OpticsTest>.time: arrow.optics.Optional<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Getter<S, OpticsTest>.time: arrow.optics.Getter<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Setter<S, OpticsTest>.time: arrow.optics.Setter<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Traversal<S, OpticsTest>.time: arrow.optics.Traversal<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Fold<S, OpticsTest>.time: arrow.optics.Fold<S, Duration> inline get() = this + OpticsTest.time
inline val <S> arrow.optics.Every<S, OpticsTest>.time: arrow.optics.Every<S, Duration> inline get() = this + OpticsTest.time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant