Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractMethodError at scala.List.foreach #1939

Closed
scabug opened this issue Apr 30, 2009 · 2 comments
Closed

AbstractMethodError at scala.List.foreach #1939

scabug opened this issue Apr 30, 2009 · 2 comments
Assignees

Comments

@scabug
Copy link

scabug commented Apr 30, 2009

The error occurs at runtime, with Scala 2.8.0.r17593-b20090429021408 and 2.8.0.r17600-b20090430021415

class Module {}

abstract class T {
  type moduleType <: Module
  def module: moduleType
}

final class T1(val module: Module) extends T {
  type moduleType = Module
}

final class T2(_module: Module) extends T {
  type moduleType = Module

  def module = _module
}

object Main extends Application {

  type mType = Module

  type tType = T { type moduleType <: mType }
  // type tType = T { type moduleType <: Module } // runs successfully
  // type tType = T // runs successfully

  def f(ts: List[tType]): Unit = {

    for (t <- ts; m = t.module) {}
    ts.map(_.module).foreach { _ => () }
    // ts.map(t => (t : T).module).foreach { _ => () } // runs successfully
  }

  f(new T1(new Module) :: new T2(new Module) :: Nil)
}
java.lang.AbstractMethodError
        at scala.List.foreach(List.scala:849)
        at Main$$.f
@scabug
Copy link
Author

scabug commented Apr 30, 2009

Imported From: https://issues.scala-lang.org/browse/SI-1939?orig=1
Reporter: Eric Willigers (ewilligers)

@scabug
Copy link
Author

scabug commented Oct 3, 2009

@odersky said:
fixed in trunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants