question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Illegal dynamic reference: State in dynamic input task

See original GitHub issue

steps

Compile this code under sbt 1.0.0

private def testState: Def.Initialize[InputTask[Unit]] =
    Def.inputTaskDyn {
      someFunc(someParser.parsed, state.value)
    }

problem

It throws Illegal dynamic reference: State, but under 0.13.16 sbt everything is alright

expectation

Normal compilation as in sbt 0.13.16

sbt version: 1.0.0

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dwijnandcommented, Sep 23, 2017

Thanks @vovapolu, I’ll see if I can identify how this regressed.

0reactions
bjaglincommented, Oct 22, 2020

Using directly the helpers that the Def.inputTaskDyn macro code would emit if there was no false positives seems to work and to be portable across sbt 0.13.x and sbt 1.x https://github.com/sbt/sbt/blob/b18140c14b1e5fa72e2709576aede414298c3f91/main-settings/src/main/scala/sbt/InputTask.scala#L93-L100

Example of replacing the workaround mentioned just above with that: https://github.com/scalacenter/sbt-scalafix/pull/126/commits/2ca68e4f38cc39d5a7cdd32658e69bcad9d5b6ca#diff-b6db8e3499369917214568aee2dd0960R168

Read more comments on GitHub >

github_iconTop Results From Across the Web

sbt illegal dynamic reference in runMain - Stack Overflow
The dynamic variable file is used as the argument of toTask , which the current macro implementation prohibits. Why static? Sbt forces task...
Read more >
Defining a dynamic input task with Def.inputTaskDyn - SBT
Here's how we can sequence a task after an input tasks. ... the continuation task, simply rewiring runopen to Compile / run will...
Read more >
Paths - AWS Step Functions
Reference Paths. A reference path is a path whose syntax is limited in such a way that it can identify only a single...
Read more >
[Solved]-sbt illegal dynamic reference in runMain-scala
The dynamic variable file is used as the argument of toTask , which the current macro implementation prohibits. Why static? Sbt forces task...
Read more >
Troubleshooting Simulation Errors - MATLAB & Simulink
If you get an error message about a missing reference block, or node, ... Simscape solver can handle dependencies among dynamic states that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found