scala 2.8.0.RC2 compiler problem on pattern matching statement?

Posted by gruenewa on Stack Overflow See other posts from Stack Overflow or by gruenewa
Published on 2010-05-24T10:44:13Z Indexed on 2010/05/24 10:51 UTC
Read the original article Hit count: 194

Filed under:

Why does the following module not compile on Scala 2.8.RC[1,2]?

object Test {

    import util.matching.Regex._

    val pVoid = """\s*void\s*""".r
    val pVoidPtr = """\s*(const\s+)?void\s*\*\s*""".r
    val pCharPtr = """\s*(const\s+)GLchar\s*\*\s*""".r
    val pIntPtr = """\s*(const\s+)?GLint\s*\*\s*""".r
    val pUintPtr = """\s*(const\s+)?GLuint\s*\*\s*""".r
    val pFloatPtr = """\s*(const\s+)?GLfloat\s*\*\s*""".r
    val pDoublePtr = """\s*(const\s+)?GLdouble\s*\*\s*""".r
    val pShortPtr = """\s*(const\s+)?GLshort\s*\*\s*""".r
    val pUshortPtr = """\s*(const\s+)?GLushort\s*\*\s*""".r
    val pInt64Ptr = """\s*(const\s+)?GLint64\s*\*\s*""".r
    val pUint64Ptr = """\s*(const\s+)?GLuint64\s*\*\s*""".r

    def mapType(t: String): String = t.trim match {
      case pVoid() => "Unit"
      case pVoidPtr() => "ByteBuffer"
      case pCharPtr() => "CharBuffer"
      case pIntPtr() | pUintPtr() => "IntBuffer"
      case pFloatPtr() => "FloatBuffer"
      case pShortPtr() | pUshortPtr() => "ShortBuffer"
      case pDoublePtr() => "DoubleBuffer"
      case pInt64Ptr() | pUint64Ptr() => "LongBuffer"
      case x => x
    }
}

© Stack Overflow or respective owner

Related posts about scala