Git Product home page Git Product logo

Comments (7)

MateuszKubuszok avatar MateuszKubuszok commented on September 27, 2024 1

Couldn't reproduce in Scastie:

Then the reproduction from https://github.com/little-inferno/chimney-error worked.

However, commenting out

//ThisBuild / scalacOptions += "-Ymacro-annotations"

make the code work again. I am not sure what is the cause, but presence of "-Ymacro-annotations" changes what macros sees internally, I suspect that we might have a workaround for such cases which did not survive the rewrite as it's difficult to have a regression test for something as unpredictable as compiler flag changing the data available to the macro. I might take a look at this somewhere in the next week if I'll have the time.

from chimney.

MateuszKubuszok avatar MateuszKubuszok commented on September 27, 2024 1

I have something local, but I'd need to add regression tests to make sure it works and would keep working.

from chimney.

MateuszKubuszok avatar MateuszKubuszok commented on September 27, 2024 1

As far as I tested the fix I merged worked. I tested with local snapshot, once https://github.com/scalalandio/chimney/actions/runs/9761346064/job/26942175116 passed you might check as well with a Sonatype OSS shapshots.

from chimney.

little-inferno avatar little-inferno commented on September 27, 2024

Yes, it seems that using -Ymacro-annotations change decoded name from

apply$default$idx

to

<init>$default$idx

And this matching give an error

val foundDefault = companion.typeSignature.decls
.to(List)
.collectFirst {
case method if getDecodedName(method) == scala2default => TermName(scala2default)
case method if getDecodedName(method) == scala3default => TermName(scala3default)
}
.getOrElse(
assertionFailed(
s"Expected that ${Type.prettyPrint[A]}'s constructor parameter `$param` would have default value: attempted `$scala2default` and `$scala3default`, found: ${companion.typeSignature.decls}"
)
)

I wrote dirty quickfix and it fix compilation errors in https://github.com/little-inferno/chimney-error

from chimney.

MateuszKubuszok avatar MateuszKubuszok commented on September 27, 2024

My local fix was quite similar to your - I'd add a test for default value in a class which is not case class, and maybe something with -Ymacro-annotations. I suspect that missing tpe.typeSymbol.typeSingature was the issue, since there was an unfixed bug in Scala 2 macros when sometimes type symbol is not initialized until this method is called (even if it's completely not needed). But I haven't tested this PR at all.

from chimney.

little-inferno avatar little-inferno commented on September 27, 2024

Great, there are no more errors with the default parameters 🎉

from chimney.

MateuszKubuszok avatar MateuszKubuszok commented on September 27, 2024

Released in 1.3.0

from chimney.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.