Skip to content

Fix compile in Scala 2.10.1+ #1509

Merged
merged 1 commit into from Jan 16, 2014

4 participants

@pbrant
Lift Web Framework member
pbrant commented Dec 20, 2013

Scala 2.10.1 includes a type checking bug fix that causes compilation to
fail. Add casts to work around this (effectively restoring the previous
behavior).

@pbrant pbrant Fix compile in Scala 2.10.1+
Scala 2.10.1 includes a type checking bug fix that causes compilation to
fail.  Add casts to work around this (effectively restoring the previous
behavior).
8d5c917
@farmdawgnation farmdawgnation commented on the diff Dec 20, 2013
...bkit/src/main/scala/net/liftweb/http/LiftScreen.scala
@@ -360,7 +360,7 @@ trait AbstractScreen extends Factory {
case AVal(v: (T => List[FieldError])) => v
},
stuff.toList.collect {
- case AFilter(v) => v
+ case AFilter(v) => v.asInstanceOf[T => T]
@farmdawgnation
Lift Web Framework member

So, do we want to add an if isInstanceOf[T => T] to these case statements as well? As such, this will throw an exception if it can't fit into the type. May not be a horrible idea to log a warning or something as well...

@Shadowfiend
Lift Web Framework member
Shadowfiend added a note Dec 20, 2013

I'm down for the isInstanceOf check, though it's worth mentioning that AFilter should already be providing a compiler check for the type. I think the only real concern here is reflection or something similarly weird that would ignore the compiler and run in a type-erased context could theoretically send in something other than what's expected.

@pbrant
Lift Web Framework member
pbrant added a note Dec 20, 2013
@Shadowfiend
Lift Web Framework member
Shadowfiend added a note Dec 20, 2013

I realize that. I'm not saying asInstanceOf isn't necessary, I'm saying isInstanceOf might be too much, depending on whether we view this as dealing with something we know but the compiler doesn't, or whether we view this as dealing with the potential for someone to get around the compiler to give us bad data :)

@fmpwizard
Lift Web Framework member
fmpwizard added a note Dec 22, 2013

I'll let you guys decide on this one, once you all agree, just let me know and I'll press the green merge button (or any of you could do it too :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Shadowfiend
Lift Web Framework member

Is this ready to go, @pbrant ? I don't know if you decided either way on the isInstanceOf check above.

@pbrant
Lift Web Framework member
@Shadowfiend Shadowfiend merged commit fd38c7a into master Jan 16, 2014
@Shadowfiend Shadowfiend deleted the pmb_liftscreenfix branch Jan 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.