Merge remote branch 'origin/master'

This commit is contained in:
Alex Tkachman
2012-01-20 20:21:25 +01:00
29 changed files with 176 additions and 52 deletions
+2 -1
View File
@@ -5,12 +5,13 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="IDEA 10.x" jdkType="IDEA JDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="frontend.java" />
<orderEntry type="library" name="asm" level="project" />
<orderEntry type="module" module-name="stdlib" />
<orderEntry type="library" scope="PROVIDED" name="intellij-core" level="project" />
</component>
</module>
+2 -1
View File
@@ -5,13 +5,14 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="IDEA 10.x" jdkType="IDEA JDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="backend" />
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="frontend.java" />
<orderEntry type="module" module-name="stdlib" />
<orderEntry type="module" module-name="jet.as.java.psi" />
<orderEntry type="library" name="intellij-core" level="project" />
</component>
</module>
+2 -1
View File
@@ -5,10 +5,11 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="IDEA 10.x" jdkType="IDEA JDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="frontend" />
<orderEntry type="module" module-name="stdlib" />
<orderEntry type="library" scope="PROVIDED" name="intellij-core" level="project" />
</component>
</module>
+2 -1
View File
@@ -5,8 +5,9 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="IDEA 10.x" jdkType="IDEA JDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="intellij-core" level="project" />
</component>
</module>
-10
View File
@@ -50,16 +50,6 @@ class String() : Comparable<String> {
fun plus(other : Any?) : String
fun equals(other : Any?) : Boolean
fun equalsIgnoreCase(other: String?) : Boolean
fun substring(start: Int): String
fun substring(start: Int, end: Int): String
fun startsWith(prefix: String, toffset: Int): Boolean
fun startsWith(prefix: String): Boolean
fun endsWith(suffix: String): Boolean
fun trim(): String
}
@@ -20,7 +20,10 @@ import org.jetbrains.jet.lang.resolve.scopes.receivers.ExpressionReceiver;
import org.jetbrains.jet.lang.resolve.scopes.receivers.TransientReceiver;
import org.jetbrains.jet.lang.types.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
@@ -182,7 +185,14 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
else if (body != null) {
WritableScope writableScope = newWritableScopeImpl(context).setDebugName("do..while body scope");
conditionScope = writableScope;
context.getServices().getBlockReturnedTypeWithWritableScope(writableScope, Collections.singletonList(body), CoercionStrategy.NO_COERCION, context);
List<JetElement> block;
if (body instanceof JetBlockExpression) {
block = ((JetBlockExpression)body).getStatements();
}
else {
block = Collections.<JetElement>singletonList(body);
}
context.getServices().getBlockReturnedTypeWithWritableScope(writableScope, block, CoercionStrategy.NO_COERCION, context);
}
JetExpression condition = expression.getCondition();
checkCondition(conditionScope, condition, context);
@@ -1,6 +1,5 @@
package mask
import std.io.*
import java.io.*
import java.util.*
import java.util.Iterator as It
@@ -1,6 +1,5 @@
package mask
import std.io.*
import java.io.*
import java.util.*
@@ -1,6 +1,5 @@
package mask
import std.io.*
import java.io.*
import java.util.*
@@ -1,4 +1,3 @@
import std.io.*
import std.util.*
import java.io.*
import java.util.*
@@ -1,7 +1,5 @@
package Smoke
import std.io.*
fun main(args: Array<String>) {
print(args)
}
@@ -8,4 +8,6 @@ fun test(s: String?) {
val e: String = <!TYPE_MISMATCH!>s?.length<!> ?: "empty"
val <!UNUSED_VARIABLE!>f<!>: Int = s?.length ?: b ?: 1
val <!UNUSED_VARIABLE!>g<!>: Int? = e? startsWith("s")?.length
}
}
fun String.startsWith(<!UNUSED_PARAMETER!>s<!>: String): Boolean = true
@@ -0,0 +1,16 @@
//KT-1078 Problem with visibility in do-while
package kt1078
fun test() : B {
do {
val x = foo()
} while(x.bar()) // x is not visible here!
return B()
}
class B() {
fun bar() = true
}
fun foo() = B()
+2 -1
View File
@@ -5,13 +5,14 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="true" />
</content>
<orderEntry type="jdk" jdkName="IDEA 10.x" jdkType="IDEA JDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="backend" />
<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" />
<orderEntry type="library" name="idea-full" level="project" />
</component>
</module>
@@ -191,12 +191,6 @@ public class ClassGenTest extends CodegenTestCase {
// System.out.println(generateToText());
}
public void testKt344 () throws Exception {
loadFile("regressions/kt344.jet");
// System.out.println(generateToText());
blackBox();
}
public void testKt508 () throws Exception {
loadFile("regressions/kt508.jet");
System.out.println(generateToText());
@@ -26,10 +26,6 @@ public class ExtensionFunctionsTest extends CodegenTestCase {
assertThrows(foo, Exception.class, null, new StringBuilder());
}
public void testGeneric() throws Exception {
blackBoxFile("extensionFunctions/generic.jet");
}
public void testVirtual() throws Exception {
blackBoxFile("extensionFunctions/virtual.jet");
}
@@ -503,19 +503,6 @@ public class NamespaceGenTest extends CodegenTestCase {
assertEquals("aaa", tuple4._3);
}
public void testPredicateOperator() throws Exception {
loadText("fun foo(s: String) = s?startsWith(\"J\")");
final Method main = generateFunction();
try {
assertEquals("JetBrains", main.invoke(null, "JetBrains"));
assertNull(main.invoke(null, "IntelliJ"));
}
catch (Throwable t) {
// System.out.println(generateToText());
t.printStackTrace();
}
}
public void testEscapeSequence() throws Exception {
loadText("fun foo() = \"a\\nb\\$\"");
final Method main = generateFunction();
@@ -4,6 +4,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.compiler.CompileEnvironment;
import org.jetbrains.jet.compiler.CompileSession;
import java.lang.reflect.Method;
/**
* @author alex.tkachman
*/
@@ -83,4 +85,29 @@ public class StdlibTest extends CodegenTestCase {
public void testKt274 () {
// blackBoxFile("regressions/kt274.kt");
}
//from ClassGenTest
public void testKt344 () throws Exception {
loadFile("regressions/kt344.jet");
// System.out.println(generateToText());
blackBox();
}
//from ExtensionFunctionsTest
public void testGeneric() throws Exception {
blackBoxFile("extensionFunctions/generic.jet");
}
//from NamespaceGenTest
public void testPredicateOperator() throws Exception {
loadText("fun foo(s: String) = s?startsWith(\"J\")");
final Method main = generateFunction();
try {
assertEquals("JetBrains", main.invoke(null, "JetBrains"));
assertNull(main.invoke(null, "IntelliJ"));
} catch (Throwable t) {
// System.out.println(generateToText());
t.printStackTrace();
}
}
}