GithubHelp home page GithubHelp logo

Comments (5)

dzirbel avatar dzirbel commented on June 18, 2024 2

I see, thanks for the response! For future reference, I think Kotlin/kotlinx.coroutines#3911 will be the main report going forward.

from jacoco.

Godin avatar Godin commented on June 18, 2024 1

🎉 here is reproducer that doesn't require coroutines library

src/a/A.kt

package a;

@Suppress("UNUSED_PARAMETER")
public fun a0(p: suspend () -> Unit) {
}

public inline fun a(crossinline p: suspend () -> Unit) = a0 { p() }

src/b/B.kt

package b;

fun b() {
  a.a { }
}

their separate compilation

kotlin-compiler-1.9.10/bin/kotlinc -d classes src/a
kotlin-compiler-1.9.10/bin/kotlinc -d classes -cp classes src/b
find classes -name "*.class" -print0 | xargs -0 javap -v -p | grep "line 0"

leads to zero line numbers

        line 0: 3
        line 0: 44

from jacoco.

marchof avatar marchof commented on June 18, 2024

Hi @dzirbel, thanks for the detailed bug report!

JaCoCo runs on Java classfiles and uses the contained debug information to extract line numbers. The line numbers are inserted by the respective compiler. It is a known issue that the Kotlin compiler sometimes emits line number 0. Please report this to the Kotlin project.

So why don't you see line number 0 in older versions? Because this was a bug in ASM (https://gitlab.ow2.org/asm/asm/-/issues/317989) which has been fixed.

from jacoco.

Godin avatar Godin commented on June 18, 2024

For the record: some time ago I did bisection of changes in Kotlin compiler (see #1471 (comment)), which unfortunately revealed change in the coroutines library (JetBrains/kotlin@a1b04a7) and not in the compiler. Unfortunately wasn't able to craft reproducer that doesn't rely on coroutines library. And unfortunately did not managed to bisect changes in the coroutines library, because was unable to build its older versions due to massive rework of external dependencies and repositories.

CC @qwwdfsad

from jacoco.

Godin avatar Godin commented on June 18, 2024

And to me seems that this is a compiler bug that was introduced during a switch to IR-based back-end:
support for crossinline suspend lambdas was added in Kotlin compiler version 1.4.0 - see JetBrains/kotlin@a1448eb
and for the above reproducer https://github.com/JetBrains/kotlin/releases/tag/v1.4-M1 produces zero line numbers only with -Xuse-ir option

from jacoco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.