39264

Cannot perform option-mapped operation with type: (Boolean, _57) => R

I have next filter

type DatabaseID = Long val filter = moderators.filter(m => (m.created < before) && (m.userType inSet userTypeList) && (if(true) m.mcID === mcIDFilter else true) )

where m.mcID has Rep[Option[models.DatabaseID]] type and mcIDFilter Option[models.DatabaseID].

Why i'm getting next error?

Cannot perform option-mapped operation with type: (Boolean, _57) => R for base type: (Boolean, Boolean) => Boolean

_57? What is it?

I have replaced condition with true for simplicity. If i remove line with condition or replace m.mcID === mcIDFilter with just true, code compiles fine.

Also if i remove if statement, it compiles without error:

val filter = moderators.filter(m => (m.created < before) && (m.userType inSet userTypeList) && m.mcID === mcIDFilter )

I found that this error appears when type one of operands have not the same type.

I also tried

val filter = moderators.filter(m => (m.created < before) && (m.userType inSet userTypeList) && (if(true) m.mcID === mcIDFilter else true:Rep[Boolean]) )

but without success.

Answer1:

Ok, i found how compile this. It's ugly, but work.

val filter = moderators.filter(m => (m.created < before) && (m.userType inSet userTypeList) && (if(true) m.mcID === mcIDFilter else Some(true):Rep[Option[Boolean]]) )

Recommend

  • Plotly and ggplot with facet_grid in R: How to to get yaxis labels to use ticktext value instead of
  • Django ORM Left Join With GROUP BY and SUM
  • Flask-Restful error: “as_view” method not inherited
  • how tensorflow worker driver training process and cause variables update on ps job?
  • What distributed message queues support millions of queues?
  • How to share a database between ASP.NET MVC 5 application and .NET console application?
  • Invoking a controller's action by button in View without redirecting to any view
  • R Impute NA's by Linear Increase Depending on Time Interval
  • Duplicate identifier error when referencing a node library using typescript
  • How to customize whisker lines on a geom_box plot differently than the lines of the box itself
  • Is mp4 stream able with ffserver?
  • Get variable height for a UIButton for iPhones 5/6/6+
  • Single django queryset to get n adjacent items
  • Are there any side effects from calling SQLAlchemy flush() within code?
  • Django return user model id with L
  • Django model for a Postgres view
  • Iron Router: How do I send data to the layout?
  • JSON encode and decode on PHP
  • Building Qt project for C++11 standard
  • Combining two different ActiveRecord collections into one
  • Unable to get column index with table.getColumn method using custom table Model
  • Keep this build forever option - Jenkins
  • How to define custom class, title, and target in Link Browser for content elements and the new rte_c
  • How do I access an unhandled exception in an MVC Error view?
  • Transactional Create with Validation in ServiceStack Redis Client
  • Hardware Accelerated Image Scaling in windows using C++
  • Google Custom Search with transparent background
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • vba code to select only visible cells in specific column except heading
  • KeystoneJS: Relationships in Admin UI not updating
  • Suggestions to manage Login/Logout transitions
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Linking SubReports Without LinkChild/LinkMaster
  • sending mail using smtp is too slow
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Busy indicator not showing up in wpf window [duplicate]
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • How can I use `wmic` in a Windows PE script?
  • To Get the radio button value in ruby on rails