Lift could annotate type of primaryKeyField as a workaround to Scala regression SI-7612 #1465

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Owner

fmpwizard commented Jul 29, 2013

The Scala team has just been notified of a regression in Scala 2.10.1 that can trigger a StackOverflowError during typechecking. The reporter was using Lift mapper.

We'll fix the regression in Scala (probably in 2.10.3, but certainly in 2.11.0). But in the meantime you might consider annotating the type of primaryKeyField in IdPK to MappedLongIndex[MapperType], rather the relying on the inferred type of id.type.

Here's where I found that code.

trait IdPK /* extends BaseLongKeyedMapper */ {
  self: BaseLongKeyedMapper =>
  def primaryKeyField = id
  def primaryKeyField = id
  object id extends MappedLongIndex[MapperType](this.asInstanceOf[MapperType])
}

A few more:

Searching 865 files for "primaryKeyField = id" (regex)

/Users/jason/code/lift-framework/persistence/mapper/src/main/scala/net/liftweb/mapper/Mapper.scala:
  316  trait IdPK /* extends BaseLongKeyedMapper */ {
  317    self: BaseLongKeyedMapper =>
  318:   def primaryKeyField = id
  319    object id extends MappedLongIndex[MapperType](this.asInstanceOf[MapperType])
  320  }

/Users/jason/code/lift-framework/persistence/mapper/src/main/scala/net/liftweb/mapper/ProtoExtendedSession.scala:
   30    self: T =>
   31  
   32:   override def primaryKeyField = id
   33  
   34    // the primary key for the database

/Users/jason/code/lift-framework/persistence/mapper/src/main/scala/net/liftweb/mapper/ProtoTag.scala:
   73    object id extends MappedLongIndex(this)
   74  
   75:   def primaryKeyField = id
   76  
   77    object name extends MappedPoliteString(this, 256) {

/Users/jason/code/lift-framework/persistence/mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala:
   39    self: T =>
   40  
   41:   override def primaryKeyField = id
   42  
   43    /**

/Users/jason/code/lift-framework/persistence/mapper/src/test/scala/net/liftweb/mapper/MapperSpecsModel.scala:
  130  
  131    // what's the "meta" server
  132:   def primaryKeyField = id
  133  
  134    object id extends MappedLongIndex(this)
  ...
  201  
  202    // what's the "meta" server
  203:   def primaryKeyField = id
  204  
  205    object id extends MappedLongIndex(this)

Apologies for the regression!

Owner

dpp commented Jun 26, 2013

Thanks for the report. We'll update Mapper.

@ghost ghost assigned fmpwizard Jul 29, 2013

@fmpwizard fmpwizard closed this in 7636751 Aug 2, 2013

@fmpwizard fmpwizard deleted the diego_issue_1465 branch Aug 2, 2013

fmpwizard added a commit that referenced this pull request Aug 8, 2013

@scabug scabug referenced this pull request in scala/bug Apr 7, 2017

Open

StackOverflowError calculating LUBs #7612

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment