fix #72 comments are allowed in class constructor; some configuration bigs fixed

This commit is contained in:
sergeych committed 2025-12-04 16:09:27 +01:00
1 parent b8f27c7a18
commit 5cfc15cf17
4 files changed
+62 -2

No files matched your search

+24
View File
@@ -176,6 +176,30 @@ kotlin.targets.configureEach {
}
}
// Ensure any SourcesJar tasks (for all targets/variants) are properly wired to the generator
tasks.withType<Jar>().configureEach {
if (name == "sourcesJar" || name.endsWith("SourcesJar")) {
// Declare both dependency and inputs to satisfy Gradle validation and up-to-date checks
dependsOn(generateLyngStdlib)
inputs.dir(generatedLyngStdlibDir)
}
}
// Extra safety: in case the SourcesJar task is not of type Jar (AGP/MPP variations),
// wire it up by name as well. This guarantees the dependency even if the concrete type differs.
tasks.configureEach {
if (name == "androidReleaseSourcesJar" || name == "sourcesJar" || name.endsWith("SourcesJar")) {
dependsOn(generateLyngStdlib)
inputs.dir(generatedLyngStdlibDir)
}
}
// Be explicit for the aggregate metadata sources task too
tasks.named("sourcesJar").configure {
dependsOn(generateLyngStdlib)
inputs.dir(generatedLyngStdlibDir)
}
android {
namespace = "org.jetbrains.kotlinx.multiplatform.library.template"
compileSdk = libs.versions.android.compileSdk.get().toInt()
@@ -832,6 +832,7 @@ class Compiler(
}
Token.Type.NEWLINE -> {}
Token.Type.MULTILINE_COMMENT, Token.Type.SINLGE_LINE_COMMENT -> {}
Token.Type.ID -> {
// visibility
@@ -15,6 +15,7 @@
*
*/
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.map
@@ -30,6 +31,22 @@ import net.sergeych.tools.bm
import kotlin.test.*
import kotlin.time.Duration.Companion.seconds
/*
* Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
class ScriptTest {
@Test
fun testVersion() {
@@ -3766,4 +3783,22 @@ class ScriptTest {
""".trimIndent())
}
@Test
fun testCommentsInClassConstructor() = runTest {
eval("""
class T(
// comment 1
val x: Int,
// comment 2
val y: String
)
println( T(1, "2") )
"""
)
}
}