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
}
}
UPDATE 1
After following the advice in the answer, the next issue is that the compilation lasts too long. Interestingly, If I remove 2 of the case statements above I get the follwing compiler error:
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
}
}
Exception in thread "main" java.lang.Error:ch.epfl.lamp.fjbg.JCode$OffsetTooBigException: offset too big to fit in 16 bits: 43772
at ch.epfl.lamp.fjbg.JFieldOrMethod.writeTo(JFieldOrMethod.java:114)
at ch.epfl.lamp.fjbg.JClass.writeTo(JClass.java:315)