Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8823759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:26:19+00:00 2026-06-14T06:26:19+00:00

I keep getting Forward reference extends over definition of value a error while trying

  • 0

I keep getting

Forward reference extends over definition of value a

error while trying to compile my application (inside SBT).

a is just val a = "", the error is triggered by accessing a particular parameter (of the function) right before a definition. The parameter is of a simple case class type with all three fields of Option[...] type (2 of Option[org.joda.time.DateTime] and 1 of Option of an enumeration value).

What can “Forward reference extends over definition of value” mean at all and what can be the ways to fight it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:26:20+00:00Added an answer on June 14, 2026 at 6:26 am

    Depending on your scalac version, there have been bugs where synthetic methods cause this error.

    https://issues.scala-lang.org/browse/SI-6278

    Illustration, imagine f is generated:

    object Test {
      def main(args: Array[String]) {
        class NotUsed {val x = f}
        val dummy = false
        def f = true
      }
    }
    

    Case classes, default arguments and implicit classes involve synthetics.

    In the example code from that ticket (which has been fixed), you can break the ok method by moving the implicit to the end of the function:

    object tiny {
    
      def main(args: Array[String]) {
        ok(); nope()
      }
      def ok() {
        class Foo(val i: Int) {
          def foo[A](body: =>A): A = body
        }
        implicit def toFoo(i: Int): Foo = new Foo(i)
    
        val k = 1
        k foo println("k?")
        val j = 2
      }
      def nope() {
        implicit class Foo(val i: Int) {
          def foo[A](body: =>A): A = body
        }
    
        val k = 1
        k foo println("k?")
        //lazy
        val j = 2
      }
    }
    

    what can be the ways to fight it?

    As implied by the comment in the code, making the definition lazy is a workaround.

    Illustration 2, imagine the function is so long that you don’t notice the naming problem:

    object Test {
      def main(args: Array[String]) {
        class NotUsed {val xs = args}
        val dummy = false
        // oops, shadows the parameter
        def args = Seq("a","b","c")
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Keep getting this error after inserting a subdatasheet into a query and trying to
I keep getting this error with my Play 2.0 application: play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[MatchError:
i keep getting a sytax error when trying to add (function (e) { e.preventDefault;
So i thought this would be straight forward but i keep getting compile errors,
I am trying to push to a remote repo but keep getting the error
I keep getting this error when trying to open a connection using entity framework.
I keep getting the error below when trying to edit any of the data
Keep getting the error Arguments are not sufficiently instantiated for the multiplication by addition
I keep getting an error saying that @android:style/Widget.Holo.Light.Button.Borderless is not public and so can't
I keep getting this error and have no idea why. I googled and scanned

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.