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 7618059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:18:11+00:00 2026-05-31T03:18:11+00:00

Here is a simplification of what I encountered. This compiles: trait A { implicit

  • 0

Here is a simplification of what I encountered. This compiles:

trait A { implicit val x = 1 }
trait B extends A { val y = implicitly[Int] }

While this don’t (could not find implicit value):

trait B extends A { val y = implicitly[Int] }
trait A { implicit val x = 1 }

I tried to make my intentions clear by specifying a self-type: trait A { this: B => ... }, but to no avail.

How do I deal with this kind of dependencies without worrying about how my code is laid out?

  • 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-31T03:18:12+00:00Added an answer on May 31, 2026 at 3:18 am

    You need to declare the type explicitly, at least for the latter one

    trait B extends A { val y = implicitly[Int] }
    trait A { implicit val x : Int = 1 }
    

    The rules for implicit visibility is different whether its type is declared explicitely or not. If it is not, the implicit is available (as an implicit) only after the point of declaration.

    The reason is that type inference may become too difficult if the type was not declared (as in recursive routine). In many cases, inference would be easy (as in your code) but the spec has to be clear cut.

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

Sidebar

Related Questions

Here is an initial specification for a simple Address class. This is a simplification
While looking at this code (most of which has been removed for simplification of
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here's a coding problem for those that like this kind of thing. Let's see
Here is a simplification of what I'm seeing when I try to use unique_ptr
I implemented a path simplification algorithm after reading the article here: http://losingfight.com/blog/2011/05/30/how-to-implement-a-vector-brush/ It's worked
What is the best tool that can do text simplification using Java? Here is
I'm creating a report comparing total time and volume across units. Here a simplification
I'm creating logic simplification program in sml. But I have a problem for this
Consider this little program: #include <stdio.h> int main() { char c = 0xFF; printf(%d\n,

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.