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

val providers fail with @named and subclasses #9

Open
yurique opened this issue Aug 19, 2020 · 1 comment
Open

val providers fail with @named and subclasses #9

yurique opened this issue Aug 19, 2020 · 1 comment

Comments

@yurique
Copy link
Contributor

yurique commented Aug 19, 2020

import factorio._

object FactorioTest {

  trait Thing

  class WantNamedSomething(@named("volde") val some: Thing)

  @blueprint
  class TestBlueprint {
    @provides @named("volde")
    val thing: Thing = new Thing {}
// if changed to 
//
//   def thing: Thing = new Thing {}
//
// it works
  }

  val assembler = Assembler[WantNamedSomething](new TestBlueprint)
  assembler()

}

results in this error:

[error]
[error]  [Factorio]: Cannot construct an instance of an abstract class [FactorioTest.Thing named volde], provide a concrete class binder or an instance provider.
[error]
[error] While analyzing path:
[error] 0: io.saa.front.FactorioTest.WantNamedSomething ->
[error]
[error]   val assembler = Assembler[WantNamedSomething](new TestBlueprint)
[error]                                                ^
@yurique
Copy link
Contributor Author

yurique commented Aug 19, 2020

Also, if Thing is a class Thing and the val is assigned to new Thing (instead of subclassing with new Thing {}) -- val works as well.

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