diff --git a/build.xml b/build.xml
index 0ac30f1c556..4ae7170df05 100644
--- a/build.xml
+++ b/build.xml
@@ -222,6 +222,7 @@
+
diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java
index 7ee5d1d3db2..49e4c59163d 100644
--- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java
+++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java
@@ -87,6 +87,10 @@ public final class ClassInheritanceTest extends SingleFileTranslationTest {
public void testWithInitializeMethod() throws Exception {
checkFooBoxIsOk();
}
+
+ public void testInheritFromCharIterator() throws Exception {
+ checkFooBoxIsOk();
+ }
}
diff --git a/js/js.translator/src/org/jetbrains/k2js/translate/context/StaticContext.java b/js/js.translator/src/org/jetbrains/k2js/translate/context/StaticContext.java
index 37ac283840b..2c4d7c926d7 100644
--- a/js/js.translator/src/org/jetbrains/k2js/translate/context/StaticContext.java
+++ b/js/js.translator/src/org/jetbrains/k2js/translate/context/StaticContext.java
@@ -39,6 +39,7 @@ import org.jetbrains.k2js.translate.utils.JsAstUtils;
import java.util.Map;
import static org.jetbrains.jet.lang.resolve.DescriptorToSourceUtils.descriptorToDeclaration;
+import static org.jetbrains.k2js.config.LibrarySourcesConfig.STDLIB_JS_MODULE_NAME;
import static org.jetbrains.k2js.translate.utils.AnnotationsUtils.*;
import static org.jetbrains.k2js.translate.utils.JsDescriptorUtils.*;
import static org.jetbrains.k2js.translate.utils.ManglingUtils.getMangledName;
@@ -467,6 +468,8 @@ public final class StaticContext {
}
private String getExternalModuleName(DeclarationDescriptor descriptor) {
+ if (isBuiltin(descriptor)) return STDLIB_JS_MODULE_NAME;
+
PsiElement element = descriptorToDeclaration(descriptor);
if (element == null && descriptor instanceof PropertyAccessorDescriptor) {
element = descriptorToDeclaration(((PropertyAccessorDescriptor) descriptor).getCorrespondingProperty());
diff --git a/js/js.translator/testData/inheritance/cases/inheritFromCharIterator.kt b/js/js.translator/testData/inheritance/cases/inheritFromCharIterator.kt
new file mode 100644
index 00000000000..accc139271a
--- /dev/null
+++ b/js/js.translator/testData/inheritance/cases/inheritFromCharIterator.kt
@@ -0,0 +1,19 @@
+package foo
+
+class MyCharIterator : CharIterator() {
+ val data = array('O', 'K')
+ var i = 0
+
+ override fun hasNext(): Boolean = i < data.size
+ override fun nextChar(): Char = data[i++]
+}
+
+fun box(): String {
+ var r = ""
+
+ for (v in MyCharIterator()) {
+ r += v
+ }
+
+ return r
+}
\ No newline at end of file
diff --git a/jslib_files.xml b/jslib_files.xml
index 3a8a50de0bf..86a5cd63455 100644
--- a/jslib_files.xml
+++ b/jslib_files.xml
@@ -1,4 +1,9 @@
+
+
+
+
+