From 0b006e7762a8c3ec2f5d02c8c7c34b09511e6a47 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Fri, 28 May 2010 15:34:32 +0000 Subject: Re-enabled a number of previously disabled tests; according to my tests, they all currently work. --- test/disabled/jvm/JavaInteraction.check | 4 - test/disabled/jvm/JavaInteraction.scala | 23 ----- test/disabled/jvm/libnatives-32.so | Bin 5359 -> 0 bytes test/disabled/jvm/libnatives-64.so | Bin 7466 -> 0 bytes test/disabled/jvm/libnatives.jnilib | Bin 8456 -> 0 bytes test/disabled/jvm/mkLibNatives.bat | 67 -------------- test/disabled/jvm/mkLibNatives.sh | 61 ------------ test/disabled/jvm/natives-32.dll | Bin 40960 -> 0 bytes test/disabled/jvm/natives.c | 8 -- test/disabled/jvm/natives.check | 1 - test/disabled/jvm/natives.h | 21 ----- test/disabled/jvm/natives.scala | 23 ----- test/disabled/pos/t1053.scala | 6 -- test/disabled/pos/t2619.scala | 80 ---------------- test/disabled/pos/ticket2251.scala | 25 ----- test/disabled/run/stream_length.check | 1 - test/disabled/run/stream_length.scala | 15 --- test/files/jvm/JavaInteraction.check | 4 + test/files/jvm/JavaInteraction.scala | 23 +++++ test/files/jvm/libnatives-32.so | Bin 0 -> 5359 bytes test/files/jvm/libnatives-64.so | Bin 0 -> 7466 bytes test/files/jvm/libnatives.jnilib | Bin 0 -> 8456 bytes test/files/jvm/mkLibNatives.bat | 67 ++++++++++++++ test/files/jvm/mkLibNatives.sh | 61 ++++++++++++ test/files/jvm/natives-32.dll | Bin 0 -> 40960 bytes test/files/jvm/natives.c | 8 ++ test/files/jvm/natives.check | 1 + test/files/jvm/natives.h | 21 +++++ test/files/jvm/natives.scala | 23 +++++ test/files/pos/t1053.scala | 6 ++ test/files/pos/t2619.scala | 80 ++++++++++++++++ test/files/pos/ticket2251.scala | 25 +++++ test/files/run/json.scala | 158 ++++++++++++++++++++++++++++++++ test/files/run/json.scala.disabled | 158 -------------------------------- test/files/run/stream_length.check | 1 + test/files/run/stream_length.scala | 15 +++ 36 files changed, 493 insertions(+), 493 deletions(-) delete mode 100644 test/disabled/jvm/JavaInteraction.check delete mode 100644 test/disabled/jvm/JavaInteraction.scala delete mode 100644 test/disabled/jvm/libnatives-32.so delete mode 100644 test/disabled/jvm/libnatives-64.so delete mode 100644 test/disabled/jvm/libnatives.jnilib delete mode 100755 test/disabled/jvm/mkLibNatives.bat delete mode 100755 test/disabled/jvm/mkLibNatives.sh delete mode 100644 test/disabled/jvm/natives-32.dll delete mode 100644 test/disabled/jvm/natives.c delete mode 100644 test/disabled/jvm/natives.check delete mode 100644 test/disabled/jvm/natives.h delete mode 100644 test/disabled/jvm/natives.scala delete mode 100644 test/disabled/pos/t1053.scala delete mode 100644 test/disabled/pos/t2619.scala delete mode 100644 test/disabled/pos/ticket2251.scala delete mode 100644 test/disabled/run/stream_length.check delete mode 100644 test/disabled/run/stream_length.scala create mode 100644 test/files/jvm/JavaInteraction.check create mode 100644 test/files/jvm/JavaInteraction.scala create mode 100644 test/files/jvm/libnatives-32.so create mode 100644 test/files/jvm/libnatives-64.so create mode 100644 test/files/jvm/libnatives.jnilib create mode 100755 test/files/jvm/mkLibNatives.bat create mode 100755 test/files/jvm/mkLibNatives.sh create mode 100644 test/files/jvm/natives-32.dll create mode 100644 test/files/jvm/natives.c create mode 100644 test/files/jvm/natives.check create mode 100644 test/files/jvm/natives.h create mode 100644 test/files/jvm/natives.scala create mode 100644 test/files/pos/t1053.scala create mode 100644 test/files/pos/t2619.scala create mode 100644 test/files/pos/ticket2251.scala create mode 100644 test/files/run/json.scala delete mode 100644 test/files/run/json.scala.disabled create mode 100644 test/files/run/stream_length.check create mode 100644 test/files/run/stream_length.scala diff --git a/test/disabled/jvm/JavaInteraction.check b/test/disabled/jvm/JavaInteraction.check deleted file mode 100644 index fb9d3cdd8c..0000000000 --- a/test/disabled/jvm/JavaInteraction.check +++ /dev/null @@ -1,4 +0,0 @@ -p.x = 5 -p.c = java.awt.Color[r=255,g=0,b=0] -p.getX() = 5.0 -p.getC() = java.awt.Color[r=255,g=0,b=0] diff --git a/test/disabled/jvm/JavaInteraction.scala b/test/disabled/jvm/JavaInteraction.scala deleted file mode 100644 index 1316fad5d4..0000000000 --- a/test/disabled/jvm/JavaInteraction.scala +++ /dev/null @@ -1,23 +0,0 @@ -//############################################################################ -// Test Java interaction -//############################################################################ - -import java.awt.Color; -import java.awt.Point; - -class ColoredPoint(x: Int, y: Int, c_ : Color) extends Point(x, y) { - val c: Color = c_; - def getC(): Color = c; -} - -object Test { - def main(args: Array[String]): Unit = { - val p = new ColoredPoint(5, 7, Color.RED); - Console.println("p.x = " + p.x); - Console.println("p.c = " + p.c); - Console.println("p.getX() = " + p.getX()); - Console.println("p.getC() = " + p.getC()); - } -} - -//############################################################################ diff --git a/test/disabled/jvm/libnatives-32.so b/test/disabled/jvm/libnatives-32.so deleted file mode 100644 index ccbcdd646f..0000000000 Binary files a/test/disabled/jvm/libnatives-32.so and /dev/null differ diff --git a/test/disabled/jvm/libnatives-64.so b/test/disabled/jvm/libnatives-64.so deleted file mode 100644 index 8cc6152057..0000000000 Binary files a/test/disabled/jvm/libnatives-64.so and /dev/null differ diff --git a/test/disabled/jvm/libnatives.jnilib b/test/disabled/jvm/libnatives.jnilib deleted file mode 100644 index daac50e3df..0000000000 Binary files a/test/disabled/jvm/libnatives.jnilib and /dev/null differ diff --git a/test/disabled/jvm/mkLibNatives.bat b/test/disabled/jvm/mkLibNatives.bat deleted file mode 100755 index 100246af79..0000000000 --- a/test/disabled/jvm/mkLibNatives.bat +++ /dev/null @@ -1,67 +0,0 @@ -@echo off - -rem ########################################################################## -rem # Author : Stephane Micheloud -rem ########################################################################## - -rem ########################################################################## -rem # variables - -if "%OS%"=="Windows_NT" @setlocal - -rem debug switches are: off=0, on=1 -set DEBUG=0 -set STDOUT=NUL -if %DEBUG%==1 set STDOUT=CON - -set CLASS_NAME=Test$ -set CLASS_DIR=. - -set OBJ_NAME=natives -set LIB_NAME=natives-32 - -if "%JAVA_HOME%"=="" goto error1 -if "%VSINSTALLDIR%"=="" goto error2 - -set JAVAH=%JAVA_HOME%\bin\javah -set JAVAH_OPTIONS=-jni -force -classpath %CLASS_DIR% -o %OBJ_NAME%.h - -set CC=%VSINSTALLDIR%\vc\bin\cl -set CC_OPTIONS=/nologo /c -set CC_INCLUDES=-I%VSINSTALLDIR%\vc\include -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 - -set LNK_OPTIONS=/nologo /MT /LD - -rem variable LIB is used by the C++ linker to find libcmt.lib, .. -set LIB=%VSINSTALLDIR%\vc\lib - -rem ########################################################################## -rem # commands - -del /s/q *.obj *.exp *.lib *.dll 1>%STDOUT% - -if %DEBUG%==1 echo %JAVAH% %JAVAH_OPTIONS% %CLASS_NAME% -%JAVAH% %JAVAH_OPTIONS% %CLASS_NAME% - -if %DEBUG%==1 echo %CC% %CC_OPTIONS% %CC_INCLUDES% /Fo%OBJ_NAME%.obj natives.c -%CC% %CC_OPTIONS% %CC_INCLUDES% /Fo%OBJ_NAME%.obj natives.c 1>%STDOUT% - -if %DEBUG%==1 echo %CC% %LNK_OPTIONS% /Fe%LIB_NAME%.dll %OBJ_NAME%.obj -%CC% %LNK_OPTIONS% /Fe%LIB_NAME%.dll %OBJ_NAME%.obj 1>%STDOUT% - -goto end - -rem ########################################################################## -rem # subroutines - -:error1 -echo ERROR: environment variable JAVA_HOME is undefined. It should point to your JDK installation. -goto end - -:error2 -echo ERROR: environment variable VSINSTALLDIR is undefined. It should point to your MS Visual Studio installation. -goto end - -:end -if "%OS%"=="Windows_NT" @endlocal - diff --git a/test/disabled/jvm/mkLibNatives.sh b/test/disabled/jvm/mkLibNatives.sh deleted file mode 100755 index ed80c24c3e..0000000000 --- a/test/disabled/jvm/mkLibNatives.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -############################################################################## -# Author : Stephane Micheloud -############################################################################## - -############################################################################## -# variables - -# set any value to enable debugging output -debug= - -cygwin=false; -darwin=false; -case "`uname`" in - CYGWIN*) cygwin=true ;; - Darwin*) darwin=true ;; -esac - -CLASS_NAME=Test\$ -CLASS_DIR=natives-jvm.obj - -OBJ_NAME=natives -LIB_NAME=libnatives - -if [ -z "${JAVA_HOME}" ]; then - echo "environment variable JAVA_HOME is undefined." - exit -elif $cygwin; then - echo "Cygwin not supported (use 'mkLibNatives.bat')." - exit -fi - -JAVAH=${JAVA_HOME}/bin/javah -JAVAH_OPTIONS="-jni -force -classpath ${CLASS_DIR} -o ${OBJ_NAME}.h" - -CC=gcc - -if $darwin; then - CC_OPTIONS="-c -arch ppc -arch i386" - CC_INCLUDES="-I/System/Library/Frameworks/JavaVM.framework/Headers" - LNK_OPTIONS="-dynamiclib -framework JavaVM" - FULL_LIB_NAME=${LIB_NAME}.jnilib -else - CC_OPTIONS=-c - CC_INCLUDES="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/${OSTYPE}" - LNK_OPTIONS="-shared -Wl,-soname,${LIB_NAME}" - FULL_LIB_NAME=${LIB_NAME}.so -fi - -############################################################################## -# commands - -[ $debug ] && echo ${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME} -${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME} - -[ $debug ] && echo ${CC} ${CC_OPTIONS} ${CC_INCLUDES} -o ${OBJ_NAME}.o natives.c -${CC} ${CC_OPTIONS} ${CC_INCLUDES} -o ${OBJ_NAME}.o natives.c - -[ $debug ] && echo ${CC} ${LNK_OPTIONS} -o ${FULL_LIB_NAME} ${OBJ_NAME}.o -${CC} ${LNK_OPTIONS} -o ${FULL_LIB_NAME} ${OBJ_NAME}.o diff --git a/test/disabled/jvm/natives-32.dll b/test/disabled/jvm/natives-32.dll deleted file mode 100644 index a06c1da3e3..0000000000 Binary files a/test/disabled/jvm/natives-32.dll and /dev/null differ diff --git a/test/disabled/jvm/natives.c b/test/disabled/jvm/natives.c deleted file mode 100644 index 7b6d7b5ba5..0000000000 --- a/test/disabled/jvm/natives.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "natives.h" - -JNIEXPORT jstring JNICALL Java_Test_00024_sayHello - (JNIEnv *env, jobject thisobject, jstring js) - -{ - return js; -} diff --git a/test/disabled/jvm/natives.check b/test/disabled/jvm/natives.check deleted file mode 100644 index 2265459198..0000000000 --- a/test/disabled/jvm/natives.check +++ /dev/null @@ -1 +0,0 @@ -Invocation returned "Scala is great!" diff --git a/test/disabled/jvm/natives.h b/test/disabled/jvm/natives.h deleted file mode 100644 index 0d360d3654..0000000000 --- a/test/disabled/jvm/natives.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class Test__ */ - -#ifndef _Included_Test__ -#define _Included_Test__ -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: Test__ - * Method: sayHello - * Signature: (Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_Test_00024_sayHello - (JNIEnv *, jobject, jstring); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/test/disabled/jvm/natives.scala b/test/disabled/jvm/natives.scala deleted file mode 100644 index 14ee4e1c1b..0000000000 --- a/test/disabled/jvm/natives.scala +++ /dev/null @@ -1,23 +0,0 @@ -object Test { - - //println("java.library.path=" + System.getProperty("java.library.path")) - - val sysWordSize = System.getProperty("sun.arch.data.model", "32") - val sysType = System.getProperty("os.name") - - val libName = - if (sysType == "Mac OS X") - "natives" - else - "natives-" + sysWordSize - - System.loadLibrary(libName) - - @native - def sayHello(s: String): String = null - - def main(args: Array[String]) { - val s = sayHello("Scala is great!") - println("Invocation returned \"" + s + "\"") - } -} diff --git a/test/disabled/pos/t1053.scala b/test/disabled/pos/t1053.scala deleted file mode 100644 index 1d4dfb637e..0000000000 --- a/test/disabled/pos/t1053.scala +++ /dev/null @@ -1,6 +0,0 @@ -trait T[A] { trait U { type W = A; val x = 3 } } - -object Test { - val x : ({ type V = T[this.type] })#V = null - val y = new x.U { } -} diff --git a/test/disabled/pos/t2619.scala b/test/disabled/pos/t2619.scala deleted file mode 100644 index 565bc9572b..0000000000 --- a/test/disabled/pos/t2619.scala +++ /dev/null @@ -1,80 +0,0 @@ -abstract class F { - final def apply(x: Int): AnyRef = null -} -abstract class AbstractModule { - def as: List[AnyRef] - def ms: List[AbstractModule] - def fs: List[F] = Nil - def rs(x: Int): List[AnyRef] = fs.map(_(x)) -} -abstract class ModuleType1 extends AbstractModule {} -abstract class ModuleType2 extends AbstractModule {} - -object ModuleAE extends ModuleType1 { - def as = Nil - def ms = Nil -} -object ModuleAF extends ModuleType2 { - def as = Nil - def ms = List(ModuleAE) -} -object ModuleAG extends ModuleType1 { - def as = List("") - def ms = Nil -} -object ModuleAI extends ModuleType1 { - def as = Nil - def ms = List(ModuleAE) -} -object ModuleAK extends ModuleType2 { - def as = Nil - def ms = List(ModuleAF) -} -object ModuleAL extends ModuleType1 { - def as = Nil - def ms = List( - ModuleAG, - ModuleAI - ) -} -object ModuleAM extends ModuleType1 { - def as = Nil - def ms = List( - ModuleAL, - ModuleAE - ) ::: List(ModuleAK) -} -object ModuleBE extends ModuleType1 { - def as = Nil - def ms = Nil -} -object ModuleBF extends ModuleType2 { - def as = Nil - def ms = List(ModuleBE) -} -object ModuleBG extends ModuleType1 { - def as = List("") - def ms = Nil -} -object ModuleBI extends ModuleType1 { - def as = Nil - def ms = List(ModuleBE) -} -object ModuleBK extends ModuleType2 { - def as = Nil - def ms = List(ModuleBF) -} -object ModuleBL extends ModuleType1 { - def as = Nil - def ms = List( - ModuleBG, - ModuleBI - ) -} -object ModuleBM extends ModuleType1 { - def as = Nil - def ms = List( - ModuleBL, - ModuleBE - ) ::: List(ModuleBK) -} \ No newline at end of file diff --git a/test/disabled/pos/ticket2251.scala b/test/disabled/pos/ticket2251.scala deleted file mode 100644 index 7b6efb0ea0..0000000000 --- a/test/disabled/pos/ticket2251.scala +++ /dev/null @@ -1,25 +0,0 @@ - -// Martin: I am not sure this is a solvable problem right now. I'll leave it in pending. -// derived from pos/bug1001 -class A -trait B[T <: B[T]] extends A -class C extends B[C] -class D extends B[D] - -class Data { - // force computing lub of C and D (printLubs enabled:) - -/* -lub of List(D, C) at depth 2 - lub of List(D, C) at depth 1 - lub of List(D, C) at depth 0 - lub of List(D, C) is A - lub of List(D, C) is B[_1] forSome { type _1 >: D with C <: A } -lub of List(D, C) is B[_2] forSome { type _2 >: D with C{} <: B[_1] forSome { type _1 >: D with C{} <: A } } -*/ -// --> result = WRONG - - // should be: B[X] forSome {type X <: B[X]} -- can this be done automatically? for now, just detect f-bounded polymorphism and fall back to more coarse approximation - - val data: List[A] = List(new C, new D) -} diff --git a/test/disabled/run/stream_length.check b/test/disabled/run/stream_length.check deleted file mode 100644 index 9906de773c..0000000000 --- a/test/disabled/run/stream_length.check +++ /dev/null @@ -1 +0,0 @@ -Length: 970299 diff --git a/test/disabled/run/stream_length.scala b/test/disabled/run/stream_length.scala deleted file mode 100644 index 68e9cad5ac..0000000000 --- a/test/disabled/run/stream_length.scala +++ /dev/null @@ -1,15 +0,0 @@ - - -object Test { - def walk(depth: Int, bias: String): Stream[String] = { - if (depth == 0) - Stream(bias) - else { - Stream.concat(Stream.range(1, 100).map((x: Int) => walk(depth-1, bias + x))) - } - } - - def main(args: Array[String]) { - println("Length: " + walk(3, "---").length) - } -} diff --git a/test/files/jvm/JavaInteraction.check b/test/files/jvm/JavaInteraction.check new file mode 100644 index 0000000000..fb9d3cdd8c --- /dev/null +++ b/test/files/jvm/JavaInteraction.check @@ -0,0 +1,4 @@ +p.x = 5 +p.c = java.awt.Color[r=255,g=0,b=0] +p.getX() = 5.0 +p.getC() = java.awt.Color[r=255,g=0,b=0] diff --git a/test/files/jvm/JavaInteraction.scala b/test/files/jvm/JavaInteraction.scala new file mode 100644 index 0000000000..1316fad5d4 --- /dev/null +++ b/test/files/jvm/JavaInteraction.scala @@ -0,0 +1,23 @@ +//############################################################################ +// Test Java interaction +//############################################################################ + +import java.awt.Color; +import java.awt.Point; + +class ColoredPoint(x: Int, y: Int, c_ : Color) extends Point(x, y) { + val c: Color = c_; + def getC(): Color = c; +} + +object Test { + def main(args: Array[String]): Unit = { + val p = new ColoredPoint(5, 7, Color.RED); + Console.println("p.x = " + p.x); + Console.println("p.c = " + p.c); + Console.println("p.getX() = " + p.getX()); + Console.println("p.getC() = " + p.getC()); + } +} + +//############################################################################ diff --git a/test/files/jvm/libnatives-32.so b/test/files/jvm/libnatives-32.so new file mode 100644 index 0000000000..ccbcdd646f Binary files /dev/null and b/test/files/jvm/libnatives-32.so differ diff --git a/test/files/jvm/libnatives-64.so b/test/files/jvm/libnatives-64.so new file mode 100644 index 0000000000..8cc6152057 Binary files /dev/null and b/test/files/jvm/libnatives-64.so differ diff --git a/test/files/jvm/libnatives.jnilib b/test/files/jvm/libnatives.jnilib new file mode 100644 index 0000000000..daac50e3df Binary files /dev/null and b/test/files/jvm/libnatives.jnilib differ diff --git a/test/files/jvm/mkLibNatives.bat b/test/files/jvm/mkLibNatives.bat new file mode 100755 index 0000000000..100246af79 --- /dev/null +++ b/test/files/jvm/mkLibNatives.bat @@ -0,0 +1,67 @@ +@echo off + +rem ########################################################################## +rem # Author : Stephane Micheloud +rem ########################################################################## + +rem ########################################################################## +rem # variables + +if "%OS%"=="Windows_NT" @setlocal + +rem debug switches are: off=0, on=1 +set DEBUG=0 +set STDOUT=NUL +if %DEBUG%==1 set STDOUT=CON + +set CLASS_NAME=Test$ +set CLASS_DIR=. + +set OBJ_NAME=natives +set LIB_NAME=natives-32 + +if "%JAVA_HOME%"=="" goto error1 +if "%VSINSTALLDIR%"=="" goto error2 + +set JAVAH=%JAVA_HOME%\bin\javah +set JAVAH_OPTIONS=-jni -force -classpath %CLASS_DIR% -o %OBJ_NAME%.h + +set CC=%VSINSTALLDIR%\vc\bin\cl +set CC_OPTIONS=/nologo /c +set CC_INCLUDES=-I%VSINSTALLDIR%\vc\include -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 + +set LNK_OPTIONS=/nologo /MT /LD + +rem variable LIB is used by the C++ linker to find libcmt.lib, .. +set LIB=%VSINSTALLDIR%\vc\lib + +rem ########################################################################## +rem # commands + +del /s/q *.obj *.exp *.lib *.dll 1>%STDOUT% + +if %DEBUG%==1 echo %JAVAH% %JAVAH_OPTIONS% %CLASS_NAME% +%JAVAH% %JAVAH_OPTIONS% %CLASS_NAME% + +if %DEBUG%==1 echo %CC% %CC_OPTIONS% %CC_INCLUDES% /Fo%OBJ_NAME%.obj natives.c +%CC% %CC_OPTIONS% %CC_INCLUDES% /Fo%OBJ_NAME%.obj natives.c 1>%STDOUT% + +if %DEBUG%==1 echo %CC% %LNK_OPTIONS% /Fe%LIB_NAME%.dll %OBJ_NAME%.obj +%CC% %LNK_OPTIONS% /Fe%LIB_NAME%.dll %OBJ_NAME%.obj 1>%STDOUT% + +goto end + +rem ########################################################################## +rem # subroutines + +:error1 +echo ERROR: environment variable JAVA_HOME is undefined. It should point to your JDK installation. +goto end + +:error2 +echo ERROR: environment variable VSINSTALLDIR is undefined. It should point to your MS Visual Studio installation. +goto end + +:end +if "%OS%"=="Windows_NT" @endlocal + diff --git a/test/files/jvm/mkLibNatives.sh b/test/files/jvm/mkLibNatives.sh new file mode 100755 index 0000000000..ed80c24c3e --- /dev/null +++ b/test/files/jvm/mkLibNatives.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +############################################################################## +# Author : Stephane Micheloud +############################################################################## + +############################################################################## +# variables + +# set any value to enable debugging output +debug= + +cygwin=false; +darwin=false; +case "`uname`" in + CYGWIN*) cygwin=true ;; + Darwin*) darwin=true ;; +esac + +CLASS_NAME=Test\$ +CLASS_DIR=natives-jvm.obj + +OBJ_NAME=natives +LIB_NAME=libnatives + +if [ -z "${JAVA_HOME}" ]; then + echo "environment variable JAVA_HOME is undefined." + exit +elif $cygwin; then + echo "Cygwin not supported (use 'mkLibNatives.bat')." + exit +fi + +JAVAH=${JAVA_HOME}/bin/javah +JAVAH_OPTIONS="-jni -force -classpath ${CLASS_DIR} -o ${OBJ_NAME}.h" + +CC=gcc + +if $darwin; then + CC_OPTIONS="-c -arch ppc -arch i386" + CC_INCLUDES="-I/System/Library/Frameworks/JavaVM.framework/Headers" + LNK_OPTIONS="-dynamiclib -framework JavaVM" + FULL_LIB_NAME=${LIB_NAME}.jnilib +else + CC_OPTIONS=-c + CC_INCLUDES="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/${OSTYPE}" + LNK_OPTIONS="-shared -Wl,-soname,${LIB_NAME}" + FULL_LIB_NAME=${LIB_NAME}.so +fi + +############################################################################## +# commands + +[ $debug ] && echo ${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME} +${JAVAH} ${JAVAH_OPTIONS} ${CLASS_NAME} + +[ $debug ] && echo ${CC} ${CC_OPTIONS} ${CC_INCLUDES} -o ${OBJ_NAME}.o natives.c +${CC} ${CC_OPTIONS} ${CC_INCLUDES} -o ${OBJ_NAME}.o natives.c + +[ $debug ] && echo ${CC} ${LNK_OPTIONS} -o ${FULL_LIB_NAME} ${OBJ_NAME}.o +${CC} ${LNK_OPTIONS} -o ${FULL_LIB_NAME} ${OBJ_NAME}.o diff --git a/test/files/jvm/natives-32.dll b/test/files/jvm/natives-32.dll new file mode 100644 index 0000000000..a06c1da3e3 Binary files /dev/null and b/test/files/jvm/natives-32.dll differ diff --git a/test/files/jvm/natives.c b/test/files/jvm/natives.c new file mode 100644 index 0000000000..7b6d7b5ba5 --- /dev/null +++ b/test/files/jvm/natives.c @@ -0,0 +1,8 @@ +#include "natives.h" + +JNIEXPORT jstring JNICALL Java_Test_00024_sayHello + (JNIEnv *env, jobject thisobject, jstring js) + +{ + return js; +} diff --git a/test/files/jvm/natives.check b/test/files/jvm/natives.check new file mode 100644 index 0000000000..2265459198 --- /dev/null +++ b/test/files/jvm/natives.check @@ -0,0 +1 @@ +Invocation returned "Scala is great!" diff --git a/test/files/jvm/natives.h b/test/files/jvm/natives.h new file mode 100644 index 0000000000..0d360d3654 --- /dev/null +++ b/test/files/jvm/natives.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class Test__ */ + +#ifndef _Included_Test__ +#define _Included_Test__ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: Test__ + * Method: sayHello + * Signature: (Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_Test_00024_sayHello + (JNIEnv *, jobject, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/test/files/jvm/natives.scala b/test/files/jvm/natives.scala new file mode 100644 index 0000000000..14ee4e1c1b --- /dev/null +++ b/test/files/jvm/natives.scala @@ -0,0 +1,23 @@ +object Test { + + //println("java.library.path=" + System.getProperty("java.library.path")) + + val sysWordSize = System.getProperty("sun.arch.data.model", "32") + val sysType = System.getProperty("os.name") + + val libName = + if (sysType == "Mac OS X") + "natives" + else + "natives-" + sysWordSize + + System.loadLibrary(libName) + + @native + def sayHello(s: String): String = null + + def main(args: Array[String]) { + val s = sayHello("Scala is great!") + println("Invocation returned \"" + s + "\"") + } +} diff --git a/test/files/pos/t1053.scala b/test/files/pos/t1053.scala new file mode 100644 index 0000000000..1d4dfb637e --- /dev/null +++ b/test/files/pos/t1053.scala @@ -0,0 +1,6 @@ +trait T[A] { trait U { type W = A; val x = 3 } } + +object Test { + val x : ({ type V = T[this.type] })#V = null + val y = new x.U { } +} diff --git a/test/files/pos/t2619.scala b/test/files/pos/t2619.scala new file mode 100644 index 0000000000..565bc9572b --- /dev/null +++ b/test/files/pos/t2619.scala @@ -0,0 +1,80 @@ +abstract class F { + final def apply(x: Int): AnyRef = null +} +abstract class AbstractModule { + def as: List[AnyRef] + def ms: List[AbstractModule] + def fs: List[F] = Nil + def rs(x: Int): List[AnyRef] = fs.map(_(x)) +} +abstract class ModuleType1 extends AbstractModule {} +abstract class ModuleType2 extends AbstractModule {} + +object ModuleAE extends ModuleType1 { + def as = Nil + def ms = Nil +} +object ModuleAF extends ModuleType2 { + def as = Nil + def ms = List(ModuleAE) +} +object ModuleAG extends ModuleType1 { + def as = List("") + def ms = Nil +} +object ModuleAI extends ModuleType1 { + def as = Nil + def ms = List(ModuleAE) +} +object ModuleAK extends ModuleType2 { + def as = Nil + def ms = List(ModuleAF) +} +object ModuleAL extends ModuleType1 { + def as = Nil + def ms = List( + ModuleAG, + ModuleAI + ) +} +object ModuleAM extends ModuleType1 { + def as = Nil + def ms = List( + ModuleAL, + ModuleAE + ) ::: List(ModuleAK) +} +object ModuleBE extends ModuleType1 { + def as = Nil + def ms = Nil +} +object ModuleBF extends ModuleType2 { + def as = Nil + def ms = List(ModuleBE) +} +object ModuleBG extends ModuleType1 { + def as = List("") + def ms = Nil +} +object ModuleBI extends ModuleType1 { + def as = Nil + def ms = List(ModuleBE) +} +object ModuleBK extends ModuleType2 { + def as = Nil + def ms = List(ModuleBF) +} +object ModuleBL extends ModuleType1 { + def as = Nil + def ms = List( + ModuleBG, + ModuleBI + ) +} +object ModuleBM extends ModuleType1 { + def as = Nil + def ms = List( + ModuleBL, + ModuleBE + ) ::: List(ModuleBK) +} \ No newline at end of file diff --git a/test/files/pos/ticket2251.scala b/test/files/pos/ticket2251.scala new file mode 100644 index 0000000000..7b6efb0ea0 --- /dev/null +++ b/test/files/pos/ticket2251.scala @@ -0,0 +1,25 @@ + +// Martin: I am not sure this is a solvable problem right now. I'll leave it in pending. +// derived from pos/bug1001 +class A +trait B[T <: B[T]] extends A +class C extends B[C] +class D extends B[D] + +class Data { + // force computing lub of C and D (printLubs enabled:) + +/* +lub of List(D, C) at depth 2 + lub of List(D, C) at depth 1 + lub of List(D, C) at depth 0 + lub of List(D, C) is A + lub of List(D, C) is B[_1] forSome { type _1 >: D with C <: A } +lub of List(D, C) is B[_2] forSome { type _2 >: D with C{} <: B[_1] forSome { type _1 >: D with C{} <: A } } +*/ +// --> result = WRONG + + // should be: B[X] forSome {type X <: B[X]} -- can this be done automatically? for now, just detect f-bounded polymorphism and fall back to more coarse approximation + + val data: List[A] = List(new C, new D) +} diff --git a/test/files/run/json.scala b/test/files/run/json.scala new file mode 100644 index 0000000000..ec0bad7ebe --- /dev/null +++ b/test/files/run/json.scala @@ -0,0 +1,158 @@ +import scala.util.parsing.json._ + +object Test extends Application { + def printJSON(s: String) { + println(JSON parse s) + } + printJSON("{\"name\": \"value\"}") + printJSON("{\"name\": \"va1ue\"}") // ticket #136 + printJSON("{\"name\": { \"name1\": \"va1ue1\", \"name2\": \"va1ue2\" } }") + printJSON("{\"name\": \"\\u0022\"}") + printJSON("{\"age\": 0}") + println + + // from http://en.wikipedia.org/wiki/JSON + val sample1 = """ +{ + "firstName": "John", + "lastName": "Smith", + "address": { + "streetAddress": "21 2nd Street", + "city": "New York", + "state": "NY", + "postalCode": 10021 + }, + "phoneNumbers": [ + "212 732-1234", + "646 123-4567" + ] +}""" + //println(sample1) + printJSON(sample1) + println + + // from http://www.developer.com/lang/jscript/article.php/3596836 + val sample2 = """ +{ + "fullname": "Sean Kelly", + "org": "SK Consulting", + "emailaddrs": [ + {"type": "work", "value": "kelly@seankelly.biz"}, + {"type": "home", "pref": 1, "value": "kelly@seankelly.tv"} + ], + "telephones": [ + {"type": "work", "pref": 1, "value": "+1 214 555 1212"}, + {"type": "fax", "value": "+1 214 555 1213"}, + {"type": "mobile", "value": "+1 214 555 1214"} + ], + "addresses": [ + {"type": "work", "format": "us", + "value": "1234 Main StnSpringfield, TX 78080-1216"}, + {"type": "home", "format": "us", + "value": "5678 Main StnSpringfield, TX 78080-1316"} + ], + "urls": [ + {"type": "work", "value": "http://seankelly.biz/"}, + {"type": "home", "value": "http://seankelly.tv/"} + ] +}""" + //println(sample2) + printJSON(sample2) + println + + // from http://json.org/example.html + val sample3 = """ +{"web-app": { + "servlet": [ + { + "servlet-name": "cofaxCDS", + "servlet-class": "org.cofax.cds.CDSServlet", + "init-param": { + "configGlossary:installationAt": "Philadelphia, PA", + "configGlossary:adminEmail": "ksm@pobox.com", + "configGlossary:poweredBy": "Cofax", + "configGlossary:poweredByIcon": "/images/cofax.gif", + "configGlossary:staticPath": "/content/static", + "templateProcessorClass": "org.cofax.WysiwygTemplate", + "templateLoaderClass": "org.cofax.FilesTemplateLoader", + "templatePath": "templates", + "templateOverridePath": "", + "defaultListTemplate": "listTemplate.htm", + "defaultFileTemplate": "articleTemplate.htm", + "useJSP": false, + "jspListTemplate": "listTemplate.jsp", + "jspFileTemplate": "articleTemplate.jsp", + "cachePackageTagsTrack": 200, + "cachePackageTagsStore": 200, + "cachePackageTagsRefresh": 60, + "cacheTemplatesTrack": 100, + "cacheTemplatesStore": 50, + "cacheTemplatesRefresh": 15, + "cachePagesTrack": 200, + "cachePagesStore": 100, + "cachePagesRefresh": 10, + "cachePagesDirtyRead": 10, + "searchEngineListTemplate": "forSearchEnginesList.htm", + "searchEngineFileTemplate": "forSearchEngines.htm", + "searchEngineRobotsDb": "WEB-INF/robots.db", + "useDataStore": true, + "dataStoreClass": "org.cofax.SqlDataStore", + "redirectionClass": "org.cofax.SqlRedirection", + "dataStoreName": "cofax", + "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", + "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", + "dataStoreUser": "sa", + "dataStorePassword": "dataStoreTestQuery", + "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", + "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", + "dataStoreInitConns": 10, + "dataStoreMaxConns": 100, + "dataStoreConnUsageLimit": 100, + "dataStoreLogLevel": "debug", + "maxUrlLength": 500}}, + { + "servlet-name": "cofaxEmail", + "servlet-class": "org.cofax.cds.EmailServlet", + "init-param": { + "mailHost": "mail1", + "mailHostOverride": "mail2"}}, + { + "servlet-name": "cofaxAdmin", + "servlet-class": "org.cofax.cds.AdminServlet"}, + + { + "servlet-name": "fileServlet", + "servlet-class": "org.cofax.cds.FileServlet"}, + { + "servlet-name": "cofaxTools", + "servlet-class": "org.cofax.cms.CofaxToolsServlet", + "init-param": { + "templatePath": "toolstemplates/", + "log": 1, + "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", + "logMaxSize": "", + "dataLog": 1, + "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", + "dataLogMaxSize": "", + "removePageCache": "/content/admin/remove?cache=pages&id=", + "removeTemplateCache": "/content/admin/remove?cache=templates&id=", + "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", + "lookInContext": 1, + "adminGroupID": 4, + "betaServer": true}}], + "servlet-mapping": { + "cofaxCDS": "/", + "cofaxEmail": "/cofaxutil/aemail/*", + "cofaxAdmin": "/admin/*", + "fileServlet": "/static/*", + "cofaxTools": "/tools/*"}, + + "taglib": { + "taglib-uri": "cofax.tld", + "taglib-location": "/WEB-INF/tlds/cofax.tld"} + } +}""" + //println(sample3) + printJSON(sample3) + println +} diff --git a/test/files/run/json.scala.disabled b/test/files/run/json.scala.disabled deleted file mode 100644 index 2e7ee4aa4d..0000000000 --- a/test/files/run/json.scala.disabled +++ /dev/null @@ -1,158 +0,0 @@ -import scala.util.parsing.json._ - -object Test extends Application { - def printJSON(s: String) { - println(JSON parse s) - } - printJSON("{\"name\": \"value\"}") - printJSON("{\"name\": \"va1ue\"}") // ticket #136 - printJSON("{\"name\": { \"name1\": \"va1ue1\", \"name2\": \"va1ue2\" } }") - printJSON("{\"name\": \"\\u0022\"}") - printJSON("{\"age\": 0}") - println - - // from http://en.wikipedia.org/wiki/JSON - val sample1 = """ -{ - "firstName": "John", - "lastName": "Smith", - "address": { - "streetAddress": "21 2nd Street", - "city": "New York", - "state": "NY", - "postalCode": 10021 - }, - "phoneNumbers": [ - "212 732-1234", - "646 123-4567" - ] -}""" - //println(sample1) - printJSON(sample1) - println - - // from http://www.developer.com/lang/jscript/article.php/3596836 - val sample2 = """ -{ - "fullname": "Sean Kelly", - "org": "SK Consulting", - "emailaddrs": [ - {"type": "work", "value": "kelly@seankelly.biz"}, - {"type": "home", "pref": 1, "value": "kelly@seankelly.tv"} - ], - "telephones": [ - {"type": "work", "pref": 1, "value": "+1 214 555 1212"}, - {"type": "fax", "value": "+1 214 555 1213"}, - {"type": "mobile", "value": "+1 214 555 1214"} - ], - "addresses": [ - {"type": "work", "format": "us", - "value": "1234 Main StnSpringfield, TX 78080-1216"}, - {"type": "home", "format": "us", - "value": "5678 Main StnSpringfield, TX 78080-1316"} - ], - "urls": [ - {"type": "work", "value": "http://seankelly.biz/"}, - {"type": "home", "value": "http://seankelly.tv/"} - ] -}""" - //println(sample2) - printJSON(sample2) - println - - // from http://json.org/example.html - val sample3 = """ -{"web-app": { - "servlet": [ - { - "servlet-name": "cofaxCDS", - "servlet-class": "org.cofax.cds.CDSServlet", - "init-param": { - "configGlossary:installationAt": "Philadelphia, PA", - "configGlossary:adminEmail": "ksm@pobox.com", - "configGlossary:poweredBy": "Cofax", - "configGlossary:poweredByIcon": "/images/cofax.gif", - "configGlossary:staticPath": "/content/static", - "templateProcessorClass": "org.cofax.WysiwygTemplate", - "templateLoaderClass": "org.cofax.FilesTemplateLoader", - "templatePath": "templates", - "templateOverridePath": "", - "defaultListTemplate": "listTemplate.htm", - "defaultFileTemplate": "articleTemplate.htm", - "useJSP": false, - "jspListTemplate": "listTemplate.jsp", - "jspFileTemplate": "articleTemplate.jsp", - "cachePackageTagsTrack": 200, - "cachePackageTagsStore": 200, - "cachePackageTagsRefresh": 60, - "cacheTemplatesTrack": 100, - "cacheTemplatesStore": 50, - "cacheTemplatesRefresh": 15, - "cachePagesTrack": 200, - "cachePagesStore": 100, - "cachePagesRefresh": 10, - "cachePagesDirtyRead": 10, - "searchEngineListTemplate": "forSearchEnginesList.htm", - "searchEngineFileTemplate": "forSearchEngines.htm", - "searchEngineRobotsDb": "WEB-INF/robots.db", - "useDataStore": true, - "dataStoreClass": "org.cofax.SqlDataStore", - "redirectionClass": "org.cofax.SqlRedirection", - "dataStoreName": "cofax", - "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", - "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", - "dataStoreUser": "sa", - "dataStorePassword": "dataStoreTestQuery", - "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", - "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", - "dataStoreInitConns": 10, - "dataStoreMaxConns": 100, - "dataStoreConnUsageLimit": 100, - "dataStoreLogLevel": "debug", - "maxUrlLength": 500}}, - { - "servlet-name": "cofaxEmail", - "servlet-class": "org.cofax.cds.EmailServlet", - "init-param": { - "mailHost": "mail1", - "mailHostOverride": "mail2"}}, - { - "servlet-name": "cofaxAdmin", - "servlet-class": "org.cofax.cds.AdminServlet"}, - - { - "servlet-name": "fileServlet", - "servlet-class": "org.cofax.cds.FileServlet"}, - { - "servlet-name": "cofaxTools", - "servlet-class": "org.cofax.cms.CofaxToolsServlet", - "init-param": { - "templatePath": "toolstemplates/", - "log": 1, - "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", - "logMaxSize": "", - "dataLog": 1, - "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", - "dataLogMaxSize": "", - "removePageCache": "/content/admin/remove?cache=pages&id=", - "removeTemplateCache": "/content/admin/remove?cache=templates&id=", - "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", - "lookInContext": 1, - "adminGroupID": 4, - "betaServer": true}}], - "servlet-mapping": { - "cofaxCDS": "/", - "cofaxEmail": "/cofaxutil/aemail/*", - "cofaxAdmin": "/admin/*", - "fileServlet": "/static/*", - "cofaxTools": "/tools/*"}, - - "taglib": { - "taglib-uri": "cofax.tld", - "taglib-location": "/WEB-INF/tlds/cofax.tld"} - } -}""" - //println(sample3) - printJSON(sample3) - println -} diff --git a/test/files/run/stream_length.check b/test/files/run/stream_length.check new file mode 100644 index 0000000000..9906de773c --- /dev/null +++ b/test/files/run/stream_length.check @@ -0,0 +1 @@ +Length: 970299 diff --git a/test/files/run/stream_length.scala b/test/files/run/stream_length.scala new file mode 100644 index 0000000000..68e9cad5ac --- /dev/null +++ b/test/files/run/stream_length.scala @@ -0,0 +1,15 @@ + + +object Test { + def walk(depth: Int, bias: String): Stream[String] = { + if (depth == 0) + Stream(bias) + else { + Stream.concat(Stream.range(1, 100).map((x: Int) => walk(depth-1, bias + x))) + } + } + + def main(args: Array[String]) { + println("Length: " + walk(3, "---").length) + } +} -- cgit v1.2.3