diff --git a/.gitignore b/.gitignore
index 31cd6f6cd36..4e23564ea5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ examples/.idea/workspace.xml
confluence/target
confluence/target
out
+ideaSDK
.idea/dictionaries/yozh.xml
.idea/codeStyleSettings.xml
.idea/workspace.xml
diff --git a/.idea/ant.xml b/.idea/ant.xml
index 37ffae42808..f128e62d687 100644
--- a/.idea/ant.xml
+++ b/.idea/ant.xml
@@ -34,6 +34,14 @@
+
+
+
+
+
+
+
+
diff --git a/.idea/libraries/idea_full.xml b/.idea/libraries/idea_full.xml
new file mode 100644
index 00000000000..30b7644b98f
--- /dev/null
+++ b/.idea/libraries/idea_full.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/intellij_core.xml b/.idea/libraries/intellij_core.xml
new file mode 100644
index 00000000000..d14331541a7
--- /dev/null
+++ b/.idea/libraries/intellij_core.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/IDEA.xml b/.idea/runConfigurations/IDEA.xml
new file mode 100644
index 00000000000..9b094ed38cc
--- /dev/null
+++ b/.idea/runConfigurations/IDEA.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Jet.iml b/Jet.iml
index ef582b1af94..655126cc98a 100644
--- a/Jet.iml
+++ b/Jet.iml
@@ -2,7 +2,10 @@
-
+
+
+
+
diff --git a/compiler/backend/backend.iml b/compiler/backend/backend.iml
index c2cb311107b..89c20773203 100644
--- a/compiler/backend/backend.iml
+++ b/compiler/backend/backend.iml
@@ -5,12 +5,13 @@
-
+
+
diff --git a/compiler/cli/cli.iml b/compiler/cli/cli.iml
index 0b81faef09d..87b178e8745 100644
--- a/compiler/cli/cli.iml
+++ b/compiler/cli/cli.iml
@@ -5,13 +5,14 @@
-
+
+
diff --git a/compiler/frontend.java/frontend.java.iml b/compiler/frontend.java/frontend.java.iml
index 51021970c69..94b95ad5bde 100644
--- a/compiler/frontend.java/frontend.java.iml
+++ b/compiler/frontend.java/frontend.java.iml
@@ -5,10 +5,11 @@
-
+
+
diff --git a/compiler/frontend/frontend.iml b/compiler/frontend/frontend.iml
index 538b9791539..d0a04b011b4 100644
--- a/compiler/frontend/frontend.iml
+++ b/compiler/frontend/frontend.iml
@@ -5,8 +5,9 @@
-
+
+
diff --git a/compiler/frontend/src/jet/Library.jet b/compiler/frontend/src/jet/Library.jet
index 91afe33923d..127344a5d25 100644
--- a/compiler/frontend/src/jet/Library.jet
+++ b/compiler/frontend/src/jet/Library.jet
@@ -50,16 +50,6 @@ class String() : Comparable {
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
}
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java
index 8f9424acf64..2343a383dba 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ControlStructureTypingVisitor.java
@@ -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 block;
+ if (body instanceof JetBlockExpression) {
+ block = ((JetBlockExpression)body).getStatements();
+ }
+ else {
+ block = Collections.singletonList(body);
+ }
+ context.getServices().getBlockReturnedTypeWithWritableScope(writableScope, block, CoercionStrategy.NO_COERCION, context);
}
JetExpression condition = expression.getCondition();
checkCondition(conditionScope, condition, context);
diff --git a/compiler/testData/codegen/regressions/kt528.kt b/compiler/testData/codegen/regressions/kt528.kt
index d656fb2f6f7..39dcc7a0892 100644
--- a/compiler/testData/codegen/regressions/kt528.kt
+++ b/compiler/testData/codegen/regressions/kt528.kt
@@ -1,6 +1,5 @@
package mask
-import std.io.*
import java.io.*
import java.util.*
import java.util.Iterator as It
diff --git a/compiler/testData/codegen/regressions/kt529.kt b/compiler/testData/codegen/regressions/kt529.kt
index 546a345b1c7..55ba07dfc5e 100644
--- a/compiler/testData/codegen/regressions/kt529.kt
+++ b/compiler/testData/codegen/regressions/kt529.kt
@@ -1,6 +1,5 @@
package mask
-import std.io.*
import java.io.*
import java.util.*
diff --git a/compiler/testData/codegen/regressions/kt533.kt b/compiler/testData/codegen/regressions/kt533.kt
index 3ad813a6e0b..d6e28177601 100644
--- a/compiler/testData/codegen/regressions/kt533.kt
+++ b/compiler/testData/codegen/regressions/kt533.kt
@@ -1,6 +1,5 @@
package mask
-import std.io.*
import java.io.*
import java.util.*
diff --git a/compiler/testData/codegen/regressions/kt864.jet b/compiler/testData/codegen/regressions/kt864.jet
index 40bdba3dade..6771b2eb2cf 100644
--- a/compiler/testData/codegen/regressions/kt864.jet
+++ b/compiler/testData/codegen/regressions/kt864.jet
@@ -1,4 +1,3 @@
-import std.io.*
import std.util.*
import java.io.*
import java.util.*
diff --git a/compiler/testData/compiler/smoke/Smoke.kt b/compiler/testData/compiler/smoke/Smoke.kt
index c5ece2faf60..840ee72ff76 100644
--- a/compiler/testData/compiler/smoke/Smoke.kt
+++ b/compiler/testData/compiler/smoke/Smoke.kt
@@ -1,7 +1,5 @@
package Smoke
-import std.io.*
-
fun main(args: Array) {
print(args)
}
diff --git a/compiler/testData/diagnostics/tests/QualifiedExpressions.jet b/compiler/testData/diagnostics/tests/QualifiedExpressions.jet
index 135fbc2e89a..3ce867b2def 100644
--- a/compiler/testData/diagnostics/tests/QualifiedExpressions.jet
+++ b/compiler/testData/diagnostics/tests/QualifiedExpressions.jet
@@ -8,4 +8,6 @@ fun test(s: String?) {
val e: String = s?.length ?: "empty"
val f: Int = s?.length ?: b ?: 1
val g: Int? = e? startsWith("s")?.length
-}
\ No newline at end of file
+}
+
+fun String.startsWith(s: String): Boolean = true
\ No newline at end of file
diff --git a/compiler/testData/diagnostics/tests/scopes/kt1078.jet b/compiler/testData/diagnostics/tests/scopes/kt1078.jet
new file mode 100644
index 00000000000..2667028763e
--- /dev/null
+++ b/compiler/testData/diagnostics/tests/scopes/kt1078.jet
@@ -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()
\ No newline at end of file
diff --git a/compiler/tests/compiler-tests.iml b/compiler/tests/compiler-tests.iml
index 05bb0565855..e3a58fc3f6e 100644
--- a/compiler/tests/compiler-tests.iml
+++ b/compiler/tests/compiler-tests.iml
@@ -5,13 +5,14 @@
-
+
+
diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java
index d94efb6af13..b8753633c45 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java
@@ -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());
diff --git a/compiler/tests/org/jetbrains/jet/codegen/ExtensionFunctionsTest.java b/compiler/tests/org/jetbrains/jet/codegen/ExtensionFunctionsTest.java
index c03aebc041c..9468b0c810b 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/ExtensionFunctionsTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/ExtensionFunctionsTest.java
@@ -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");
}
diff --git a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java
index fc4f3fa3249..31e176f1819 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/NamespaceGenTest.java
@@ -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();
diff --git a/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java b/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java
index c9cad2d4bc3..fc2b4786668 100644
--- a/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java
+++ b/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java
@@ -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();
+ }
+ }
}
diff --git a/grammar/grammar.iml b/grammar/grammar.iml
index 538b9791539..c03fc491744 100644
--- a/grammar/grammar.iml
+++ b/grammar/grammar.iml
@@ -5,8 +5,9 @@
-
+
+
diff --git a/idea/idea.iml b/idea/idea.iml
index 39519927146..3b2a3f833e0 100644
--- a/idea/idea.iml
+++ b/idea/idea.iml
@@ -1,5 +1,5 @@
-
+
@@ -15,7 +15,7 @@
-
+
@@ -23,6 +23,7 @@
+
diff --git a/idea/testData/checker/QualifiedExpressions.jet b/idea/testData/checker/QualifiedExpressions.jet
index 73a2c4c677e..0527d08943d 100644
--- a/idea/testData/checker/QualifiedExpressions.jet
+++ b/idea/testData/checker/QualifiedExpressions.jet
@@ -8,4 +8,6 @@ fun test(s: String?) {
val e: String = s?.length ?: "empty"
val f: Int = s?.length ?: b ?: 1
val g: Int? = e? startsWith("s")?.length
-}
\ No newline at end of file
+}
+
+fun String.startsWith(s: String): Boolean = true
\ No newline at end of file
diff --git a/stdlib/ktSrc/String.kt b/stdlib/ktSrc/String.kt
index fe5912fa03e..0dd9653012b 100644
--- a/stdlib/ktSrc/String.kt
+++ b/stdlib/ktSrc/String.kt
@@ -8,6 +8,8 @@ inline fun String.lastIndexOf(s: String) = (this as java.lang.String).lastIndex
inline fun String.lastIndexOf(s: Char) = (this as java.lang.String).lastIndexOf(s.toString())
+inline fun String.equalsIgnoreCase(s: String) = (this as java.lang.String).equalsIgnoreCase(s)
+
inline fun String.indexOf(s : String) = (this as java.lang.String).indexOf(s)
inline fun String.indexOf(p0 : String, p1 : Int) = (this as java.lang.String).indexOf(p0, p1)
@@ -34,6 +36,10 @@ inline fun String.substring(i : Int) = (this as java.lang.String).substring(i).s
inline fun String.substring(i0 : Int, i1 : Int) = (this as java.lang.String).substring(i0, i1).sure()
+inline fun String.startsWith(prefix: String) = (this as java.lang.String).startsWith(prefix)
+
+inline fun String.startsWith(prefix: String, toffset: Int) = (this as java.lang.String).startsWith(prefix, toffset)
+
inline val String.size : Int
get() = length()
diff --git a/update_dependencies.xml b/update_dependencies.xml
new file mode 100644
index 00000000000..b79e133604a
--- /dev/null
+++ b/update_dependencies.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+