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

avoid generating internal frames #589

Merged
merged 3 commits into from
Aug 22, 2024
Merged

avoid generating internal frames #589

merged 3 commits into from
Aug 22, 2024

Conversation

fwbrasil
Copy link
Collaborator

This PR makes the Frame macro fail to compile in case the frame is in the kyo package and fixes the methods in the codebase that were missing the implicit.

@@ -1,4 +1,4 @@
package kyo.examples.ledger
package examples.ledger
Copy link
Collaborator Author

@fwbrasil fwbrasil Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moves the examples out of the kyo package so they can generate frames.

private def frameImpl(using Quotes): Expr[String] =
private[kyo] inline def internal: Frame = ${ frameImpl(true) }

private val allowKyoFileSuffixes = Set("Test.scala", "Spec.scala", "Bench.scala")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macro has this allow list for tests and benchmarks.

@fwbrasil fwbrasil force-pushed the avoid-internal-frames branch from d8746c5 to 15bfd94 Compare August 22, 2024 07:28
@fwbrasil fwbrasil force-pushed the avoid-internal-frames branch from 15bfd94 to e7fffd5 Compare August 22, 2024 07:30
@@ -17,6 +17,7 @@ given zioSchema[R, A: Flat, S](using ev: Schema[R, A], ev2: (A < S) <:< (A < (Ab
ev.toType_(isInput, isSubscription)

override def resolve(value: A < S): Step[R] =
given Frame = Frame.internal
Copy link
Collaborator Author

@fwbrasil fwbrasil Aug 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some situations where an internal frame is necessary. Frame.internal is a private[kyo] API that allows generating a frame within the kyo package.

Copy link
Collaborator

@hearnadam hearnadam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is an issue with kyo-sttp files under JS

s"""Frame cannot be derived within the kyo package: ${sym.owner.fullName}
|
|To resolve this issue:
|1. Propagate the Frame from user code using an implicit parameter.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implicit?? What is this, Scala 2.13?

@hearnadam hearnadam merged commit c8b801b into main Aug 22, 2024
3 checks passed
@hearnadam hearnadam deleted the avoid-internal-frames branch August 22, 2024 16:32
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 this pull request may close these issues.

2 participants