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

  • Home
  • SEARCH
  • 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 7045991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:35:50+00:00 2026-05-28T02:35:50+00:00

Having a problem with Scala import. I have an import problem with two classes.

  • 0

Having a problem with Scala import. I have an import problem with two classes. The first one:

package org.world
import org.gui.tokens.Token


object WorldObject {

}

abstract class WorldObject[A <: WorldObject[_]](var xPos: Float, var yPos: Float) {
  def x = xPos
  def y = yPos

  def token: Token
             ^^^^^
  def move(dx: Float, dy: Float) {// : A = new A(x + dx, y + dy)
    xPos += dx // = x + dx
    yPos += dy
  }
}

and the second one:

package org.gui.tokens

object Token {

}

And the problem is that the return type of def token: Token is underlined in red with error saying

not found: type Token

All is fine with class locations. Other classes have no similar problems. I do not remember such a situation in Java, autoimport always worked perfectly. Here it only adds the import org.gui.tokens.Token statement repeatedly in the WorldObject file over and over again… why is that? What can I do about 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-05-28T02:35:51+00:00Added an answer on May 28, 2026 at 2:35 am

    Token is an object, so saying def token: Token makes about as much sense to the compiler as saying def token: 5 or def token: "Hello".

    You either mean def token = Token, if you want to return the Token object; or you mean class Token {}; object Token extends Token {} in your tokens file, so there really is a class named Token, or you mean def token: Token.type, which means that the method must return something of the type of the object Token. (But there’s not much point, since the object Token is the only thing with the type Token.type.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with scala generics. While the first function I defined here
We are having problem with the server migration. We have one application that are
I'm having a hard time figuring this validation problem. I have one parent domain
I'm having a problem with a generic class I'm creating in Scala. I have
I'm having problem when running my Windows Forms program. In the program, I have
I would like to deserialise Scala case classes that have been serialised using lift-json.
I am having a problem with resizing my gui's made from Qt. In full
I am having a problem closing my Scala swing frame. Here is the code
I'm evaluating Scala and am having a problem with its immutable collections. I want
I am having problems using the update method of scala.collection.immutable.HashMap.I don't see the reason

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.