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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:34:24+00:00 2026-05-28T07:34:24+00:00

I am dealing with Cell and I have a problem because they are not

  • 0

I am dealing with Cell and I have a problem because they are not covariant. Here is what I want to do:

import net.liftweb.util.Cell

trait A {}
class AA extends A {}

trait T{
  val cell:Cell[A]
}

class U extends T{
  val cell:Cell[AA] = //implementation
}

I have an error because AA is a descendent of A but not equal to A.

Is there a solution?

  • 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-28T07:34:24+00:00Added an answer on May 28, 2026 at 7:34 am

    Actually, you’re mistaken. Your error is “error: overriding value cell in trait T of type Cell[AA]; method cell needs to be a stable, immutable value: def cell:Cell[AA]”.

    Now, while I might suggest having T take a type parameter V <: A and then having the cell() function return a Cell[V], the real problem here is not even really related to generics. In T, your ‘cell’ is a data member. In U, ‘cell’ is a function. The compiler simply wants you to choose one (and the one that works and makes sense is for it to be a function in both places, so… just change that “val cell” to “def cell” and give one of those ‘cell’ definitions an implementation, and you’re fine).

    Update (now that the question has been fixed):

    Alright, so, as suggested in my original answer, you’ll want trait T to take a type parameter in order to solve this, like so:

    trait A {}
    class AA extends A {}
    
    trait T[V <: A]{
      val cell:Cell[V]
    }
    
    class U(inCell: Cell[AA]) extends {val cell = inCell} with T[AA]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big table and want to sort using tablesorter. The problem I'm
I have run into a bit of a problem. Usually when dealing with UITableView
I frequently have problems dealing with DataRows returned from SqlDataAdapters . When I try
Possible Duplicate: How do I do multiple assignment in MATLAB? When dealing with cell
Dealing with classes (nested etc) does not look easy in Python , surprisingly !
I'm dealing with a web-service that serves video files (host). They provide you with
I have a Gridview control on an ASP.Net page with fixed width cells. The
while writing an algorithm dealing with excel data if we want to compare each
I have 2 views we are dealing with. Main View, and Sub View. Main
I'm pretty new to C++ so I'm not sure I'm going about this problem

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.