Any idea what might be causing this? I'll work on trying to narrow it down.
I have code like :
for (p in people) { … td { a { href = “doSomething?id=${p.id}” className = “red” +p.name } }
Those functions td and a are builders, taking extension function/closures as their last argument. The generated js is doubled, as you see below, and it crashes. p_0 is undefined.
There are some warnings about core/javautil.kt that always appear when I run the JS backend. I figured I could ignore them, but just in case there is something is wrong with my installation, here is the compiler output:
Information:Kotlin: Kotlin JPS plugin version 0.8.11 Information:Kotlin: Using kotlinHome=/Users/rob/Library/Application Support/IdeaIC13/Kotlin/kotlinc Information:Kotlin: Invoking K2JSCompiler with arguments -tags -verbose -version -printArgs -output /Users/rob/Workspace/KotlinBugs/Bug1/out/production/Bug1/Bug1.js -libraryFiles /Users/rob/Workspace/KotlinBugs/Bug1/lib/kotlin-jslib.jar -sourceFiles /Users/rob/Workspace/KotlinBugs/Bug1/src/kotlinbug1/HtmlBuilders.kt,/Users/rob/Workspace/KotlinBugs/Bug1/src/kotlinbug1/Misc.kt,/Users/rob/Workspace/KotlinBugs/Bug1/src/kotlinbug1/ProjectList.kt,/Users/rob/Workspace/KotlinBugs/Bug1/src/kotlinbug1/Theirs.kt,/Users/rob/Workspace/KotlinBugs/Bug1/src/kotlinbug1/bugs/Bugs.kt Information:Kotlin: Kotlin Compiler version 0.8.11 Information:Module “Bug1” was fully rebuilt due to project configuration/dependencies changes Information:Compilation completed successfully with 8 warnings in 9 sec Information:0 errors Information:8 warnings Warning:Kotlin: ‘E’ has a nullable upper bound. This means that a value of this type may be null. Using ‘E?’ is likely to mislead the reader (core/javautil.kt (70:25)) Warning:Kotlin: ‘E’ has a nullable upper bound. This means that a value of this type may be null. Using ‘E?’ is likely to mislead the reader (core/javautil.kt (71:25)) Warning:Kotlin: ‘V’ has a nullable upper bound. This means that a value of this type may be null. Using ‘V?’ is likely to mislead the reader (core/javautil.kt (97:42)) Warning:Kotlin: Projection is redundant: the corresponding type parameter of Map has the same variance (core/javautil.kt (100:46)) Warning:Kotlin: ‘V’ has a nullable upper bound. This means that a value of this type may be null. Using ‘V?’ is likely to mislead the reader (core/javautil.kt (101:45)) /Users/rob/Workspace/KotlinBugs/Bug1/src/kotlinbug1/ProjectList.kt Warning:(22, 17) Kotlin: Variable ‘row’ is never used Warning:(41, 9) Kotlin: Variable ‘pl’ is never used /Users/rob/Workspace/KotlinBugs/Bug1/src/kotlinbug1/Theirs.kt Warning:(22, 8) Kotlin: Parameter ‘f’ is never used