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

Macro expansion possibly breaking the compiler when service class has non-empty constructor #4

Open
keynmol opened this issue Jun 29, 2024 · 0 comments

Comments

@keynmol
Copy link
Contributor

keynmol commented Jun 29, 2024

I've not really dug deep into it, but here's a repro:

//> using dep "tech.neander::smithy4s-deriving::0.0.2"
//> using dep com.disneystreaming.smithy4s::smithy4s-http4s::0.18.22
//> using option -experimental

import smithy4s.*, deriving.{given, *}, aliases.*

import scala.annotation.experimental // the derivation of API uses experimental metaprogramming features, at this time.
import cats.effect.IO
import smithy4s.http4s.SimpleRestJsonBuilder


@experimental
@simpleRestJson
class IOService(a: Int) derives API:
  @readonly
  @httpGet("/httpbin/ip")
  def hello(): IO[String] = IO.pure("127.0.0.1")


def routesResource(service: IOService) =
  SimpleRestJsonBuilder
    .routes(service.liftService[IO])
    .resource
    .map(_.orNotFound)

This produces an error:

Compiling project (Scala 3.4.2, JVM (17))
[error] ./test.scala:26:6112
[error] wrong number of arguments at constructors for (a: Int): IOService: (proxy.super.<init> : (a: Int): IOService), expected: 1, found: 0

The error goes away if you remove the a: Int parameter in IOService constructor

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

No branches or pull requests

1 participant