Git Product home page Git Product logo

cfg's People

Contributors

carueda avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

frgomes sbinator

cfg's Issues

Question: Can this library be used with maven?

I see there is a sbt plugin requirement.. so I'm not hopeful that this can be used with maven .. but checking in any case since this library looks to fit well with our needs - and pureconfig has too many issues.

Backticks not properly handled

Cfg v. 0.0.7

Steps to reproduce behavior

@Cfg
case class WithBackticks(`my-param`: Int = 1)

Expected behavior

Proper handling regarding the config parameter my-param, so, for example:

val cfg = WithBackticks(ConfigFactory.parseString(
  "my-param = 2"
))

cfg.`my-param` ==> 2

Actual behavior

Looking at the macro expansion as done by IDEA:

case class WithBackticks(`my-param`: Int = 1) {}
object WithBackticks {
  def apply($cp: _root_.com.typesafe.config.Config): WithBackticks = {
    WithBackticks(if ($cp.hasPath("`my-param`")) $cp.getInt("`my-param`") else 1)
  }
}

That is, Cfg is not removing the backsticks to access the parameter in the input configuration.

That's the actual bug in Cfg.

Now, there's also a weird behavior when running the test above using sbt:

[error] <macro>:2: ':' expected but identifier found.
[error]   case class WithBackticks(my-param: Int = 1) {}

Despite the familiar limitations in IDEA re scalameta macros, it seems that it's actually doing better than the corresponding handling from sbt, at least with the scalameta + paradise versions used by Cfg 0.0.7 .

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.