Merge remote branch 'origin/master'

This commit is contained in:
Andrey Breslav
2011-10-20 14:45:26 +04:00
16 changed files with 215 additions and 133 deletions
+1
View File
@@ -20,6 +20,7 @@
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="frontend.java" />
<orderEntry type="module" module-name="stdlib" />
<orderEntry type="module" module-name="cli" />
</component>
</module>
@@ -13,6 +13,7 @@ import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.util.DefaultJDOMExternalizer;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.text.StringUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
@@ -158,6 +159,12 @@ public class JetRunConfiguration extends ModuleBasedConfiguration<RunConfigurati
final int classPathType = JavaParametersUtil.getClasspathType(getConfigurationModule(), MAIN_CLASS_NAME, false);
JavaParametersUtil.configureModule(getConfigurationModule(), params, classPathType, null);
params.setMainClass(MAIN_CLASS_NAME);
if (!StringUtil.isEmpty(WORKING_DIRECTORY)) {
params.setWorkingDirectory(WORKING_DIRECTORY);
}
params.setupEnvs(myEnvs, PASS_PARENT_ENVS);
params.getVMParametersList().addParametersString(VM_PARAMETERS);
params.getProgramParametersList().addParametersString(PROGRAM_PARAMETERS);
return params;
}
}
@@ -0,0 +1,13 @@
fun box() : String {
val a = Array<String?>(3)
a[0] = "a"
a[1] = "b"
a[2] = "c"
val result = 0
for(i in a.indices) {
result += i
}
if (result != 3) return "FAIL"
return "OK"
}
@@ -13,7 +13,7 @@ trait A {
fun bar(arg: Int = 240) : Int = bar2(arg/2)
}
open abstract class B() : A {
open abstract class B() : A, java.lang.Object() {
fun foo(arg: Int = 239 + 1) : Int = arg
abstract fun foo2(arg: Int = 239) : Int
@@ -23,15 +23,29 @@ open abstract class B() : A {
class C() : B() {
override fun foo2(arg: Int) : Int = arg
fun Any.toMyPrefixedString(prefix: String = "", suffix: String="") : String = prefix + " " + suffix
fun testReceiver() : String {
val res : String = "mama".toMyPrefixedString("111", "222")
System.out?.println(res)
return res
}
override fun toString() : String = "CCC"
}
// fun <T> T.toPrefixedString(prefix: String = "") = prefix + (this as java.lang.Object).toString()
fun <T> T.toPrefixedString(prefix: String = "", suffix: String="") = prefix + (this as java.lang.Object).toString() + suffix
fun box() : String {
val expected = (true, true, true, " ")
// if("mama".toPrefixedString("papa") != "papamama") return "fail"
// if("mama".toPrefixedString() != "mama") return "fail"
if("mama".toPrefixedString(suffix="321", prefix="papa") != "papamama321") return "fail"
if("mama".toPrefixedString(prefix="papa") != "papamama") return "fail"
if("mama".toPrefixedString("papa", "239") != "papamama239") return "fail"
if("mama".toPrefixedString("papa") != "papamama") return "fail"
if("mama".toPrefixedString() != "mama") return "fail"
if(C().testReceiver() != "111 222") return "fail"
if(C().bar(10) != 5) return "fail"
if(C().bar() != 120) return "fail"
if(C().foo(10) != 10) return "fail"
@@ -1,19 +0,0 @@
fun reformat(
str : String,
normalizeCase : Boolean = true,
uppercaseFirstLetter : Boolean = true,
divideByCamelHumps : Boolean = false,
wordSeparator : String = " "
) =
(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
fun box() : String {
val expected = (true, true, false, " ")
if(reformat("", true, true, false, " ") != expected) return "fail"
// if(reformat(str="", wordSeparator=" ") != expected) return "fail"
// if(reformat("", true, true, false) != expected) return "fail"
// if(reformat("", true, true) != expected) return "fail"
// if(reformat("", true) != expected) return "fail"
// if(reformat("") != expected) return "fail"
return "OK"
}
@@ -63,7 +63,7 @@ public abstract class CodegenTestCase extends LightCodeInsightFixtureTestCase {
throw new UnsupportedOperationException();
}
protected void blackBoxFile(String filename) throws Exception {
protected void blackBoxFile(String filename) {
loadFile(filename);
String actual;
try {
@@ -1,7 +1,5 @@
package org.jetbrains.jet.codegen;
import jet.typeinfo.TypeInfo;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
@@ -169,6 +167,10 @@ public class ControlStructuresTest extends CodegenTestCase {
blackBoxFile("controlStructures/forNullableIntArray.jet");
}
public void testForIntRange() {
blackBoxFile("controlStructures/forIntRange.jet");
}
public void testKt237() throws Exception {
blackBoxFile("regressions/kt237.jet");
}
@@ -6,10 +6,7 @@ package org.jetbrains.jet.codegen;
public class FunctionGenTest extends CodegenTestCase {
public void testDefaultArgs() throws Exception {
blackBoxFile("functions/defaultargs.jet");
}
public void testNamedArgs() throws Exception {
blackBoxFile("functions/defaultargs.jet");
System.out.println(generateToText());
}
public void testNoThisNoClosure() throws Exception {