Migrate MultiModuleLineMarkerTest to the new CodeMetaInfo test infrastructure

This commit is contained in:
Alexander Dudinsky
2020-10-10 10:07:31 +03:00
parent 94bf38a7b5
commit 0e7e657657
76 changed files with 278 additions and 128 deletions
@@ -107,7 +107,7 @@ class TextDiagnostic(
extractDataBefore(matcher.group(2), ":") extractDataBefore(matcher.group(2), ":")
val name = matcher.group(3) val name = matcher.group(3)
val parameters = matcher.group(4) ?: return TextDiagnostic( val parameters = matcher.group(5) ?: return TextDiagnostic(
name, name,
platform, platform,
null, null,
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,4 +1,4 @@
actual class <lineMarker descr="Has declaration in common module">WithConstructor</lineMarker> actual constructor(actual val x: Int, actual val s: String) actual class <!LINE_MARKER("descr='Has declaration in common module'")!>WithConstructor<!> actual constructor(actual val x: Int, actual val s: String)
/* /*
LINEMARKER: Has declaration in common module LINEMARKER: Has declaration in common module
@@ -1,6 +1,6 @@
open class <lineMarker descr="<html><body>Is subclassed by<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#kotlinClass/testModule_Common:ExpectedChild">ExpectedChild [testModule_Common]</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#kotlinClass/testModule_JVM:ExpectedChild">ExpectedChild [testModule_JVM]</a><br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#kotlinClass/testModule_Common:SimpleChild">SimpleChild</a><br><div style='margin-top: 5px'><font size='2'>Click or press Ctrl+Alt+B to navigate</font></div></body</html>">SimpleParent</lineMarker> open class <!LINE_MARKER("descr='Is subclassed by ExpectedChild [common] ExpectedChild [jvm] SimpleChild'")!>SimpleParent<!>
expect class <lineMarker descr="Has actuals in JVM">ExpectedChild</lineMarker> : SimpleParent expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>ExpectedChild<!> : SimpleParent
class SimpleChild : SimpleParent() class SimpleChild : SimpleParent()
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,8 +1,8 @@
package test package test
actual enum class <lineMarker>Enum</lineMarker> { actual enum class <!LINE_MARKER("descr='Has declaration in common module'")!>Enum<!> {
<lineMarker>A</lineMarker>, <!LINE_MARKER("descr='Has declaration in common module'")!>A<!>,
<lineMarker>B</lineMarker>, <!LINE_MARKER("descr='Has declaration in common module'")!>B<!>,
<lineMarker>C</lineMarker>, <!LINE_MARKER("descr='Has declaration in common module'")!>C<!>,
D D
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,6 +1,6 @@
package test package test
actual enum class <lineMarker descr="Has declaration in common module">Enum</lineMarker> { A, B, C } actual enum class <!LINE_MARKER("descr='Has declaration in common module'")!>Enum<!> { A, B, C }
/* /*
LINEMARKER: Has declaration in common module LINEMARKER: Has declaration in common module
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,5 +1,5 @@
expect class <lineMarker>WithConstructor</lineMarker>(x: Int, s: String) { expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>WithConstructor<!>(x: Int, s: String) {
val <lineMarker>x</lineMarker>: Int val <!LINE_MARKER("descr='Has actuals in JVM'")!>x<!>: Int
val <lineMarker>s</lineMarker>: String val <!LINE_MARKER("descr='Has actuals in JVM'")!>s<!>: String
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,7 +1,7 @@
package test package test
expect enum class <lineMarker>Enum</lineMarker> { expect enum class <!LINE_MARKER("descr='Has actuals in JVM'")!>Enum<!> {
<lineMarker>A</lineMarker>, <!LINE_MARKER("descr='Has actuals in JVM'")!>A<!>,
<lineMarker>B</lineMarker>, <!LINE_MARKER("descr='Has actuals in JVM'")!>B<!>,
<lineMarker>C</lineMarker> <!LINE_MARKER("descr='Has actuals in JVM'")!>C<!>
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,6 +1,6 @@
package test package test
expect enum class <lineMarker descr="Has actuals in JVM">Enum</lineMarker> { A, B, C, D } expect enum class <!LINE_MARKER("descr='Has actuals in JVM'")!>Enum<!> { A, B, C, D }
/* /*
LINEMARKER: Has actuals in JVM LINEMARKER: Has actuals in JVM
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,7 +1,7 @@
package test package test
expect enum class <lineMarker descr="Has actuals in JVM">Enum</lineMarker> { expect enum class <!LINE_MARKER("descr='Has actuals in JVM'")!>Enum<!> {
<lineMarker descr="Has actuals in JVM">A</lineMarker>, B, C, D <!LINE_MARKER("descr='Has actuals in JVM'")!>A<!>, B, C, D
} }
/* /*
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,9 +1,9 @@
package sample package sample
expect fun <lineMarker descr="Has actuals in common">sameFile</lineMarker>() expect fun <!LINE_MARKER("descr='Has actuals in common'")!>sameFile<!>()
actual fun <lineMarker>sameFile</lineMarker>() = Unit actual fun <!LINE_MARKER("descr='null'")!>sameFile<!>() = Unit
expect fun <lineMarker descr="Has actuals in common">sameModule</lineMarker>() expect fun <!LINE_MARKER("descr='Has actuals in common'")!>sameModule<!>()
fun noExpectActualDeclaration() = Unit fun noExpectActualDeclaration() = Unit
@@ -0,0 +1 @@
MODULE common { platform=[JVM, JS, Native] }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,4 +1,4 @@
actual annotation class <lineMarker>Ann</lineMarker> actual constructor( actual annotation class <!LINE_MARKER("descr='Has declaration in common module'")!>Ann<!> actual constructor(
actual val <lineMarker>x</lineMarker>: Int, actual val <!LINE_MARKER("descr='Has declaration in common module'")!>x<!>: Int,
actual val <lineMarker>y</lineMarker>: String actual val <!LINE_MARKER("descr='Has declaration in common module'")!>y<!>: String
) )
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,6 +1,6 @@
actual annotation class <lineMarker descr="Has declaration in common module">Ann</lineMarker>( actual annotation class <!LINE_MARKER("descr='Has declaration in common module'")!>Ann<!>(
actual val <lineMarker descr="Has declaration in common module">x</lineMarker>: Int, actual val y: String, actual val <!LINE_MARKER("descr='Has declaration in common module'")!>x<!>: Int, actual val y: String,
actual val <lineMarker descr="Has declaration in common module">z</lineMarker>: Double, actual val b: Boolean actual val <!LINE_MARKER("descr='Has declaration in common module'")!>z<!>: Double, actual val b: Boolean
) )
/* /*
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,5 +1,5 @@
actual class <lineMarker>WithCompanion</lineMarker> { actual class <!LINE_MARKER("descr='Has declaration in common module'")!>WithCompanion<!> {
actual companion <lineMarker>object</lineMarker> { actual companion <!LINE_MARKER("descr='Has declaration in common module'")!>object<!> {
} }
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,5 +1,5 @@
actual class <lineMarker>NoConstructor2</lineMarker>(name: String) { actual class <!LINE_MARKER("descr='Has declaration in common module'")!>NoConstructor2<!>(name: String) {
val myName = name val myName = name
actual fun <lineMarker>extraFun</lineMarker>() {} actual fun <!LINE_MARKER("descr='Has declaration in common module'")!>extraFun<!>() {}
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,10 +1,10 @@
actual sealed class <lineMarker>Sealed</lineMarker> { actual sealed class <!LINE_MARKER("descr='Is subclassed by Sealed1 in Sealed [jvm] Sealed2 in Sealed [jvm]'"), LINE_MARKER("descr='Has declaration in common module'")!>Sealed<!> {
actual object <lineMarker>Sealed1</lineMarker> : Sealed() actual object <!LINE_MARKER("descr='Has declaration in common module'")!>Sealed1<!> : Sealed()
actual class <lineMarker>Sealed2</lineMarker> : Sealed() { actual class <!LINE_MARKER("descr='Has declaration in common module'")!>Sealed2<!> : Sealed() {
actual val <lineMarker>x</lineMarker> = 42 actual val <!LINE_MARKER("descr='Has declaration in common module'")!>x<!> = 42
actual fun <lineMarker>foo</lineMarker>() = "" actual fun <!LINE_MARKER("descr='Has declaration in common module'")!>foo<!>() = ""
} }
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,5 +1,5 @@
actual class <lineMarker>SecondaryConstructor</lineMarker> { actual class <!LINE_MARKER("descr='Has declaration in common module'")!>SecondaryConstructor<!> {
actual <lineMarker>constructor</lineMarker>(name: String, surname: String) {} actual <!LINE_MARKER("descr='Has declaration in common module'")!>constructor<!>(name: String, surname: String) {}
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -2,5 +2,5 @@ class Some {
val x: String = "Some" val x: String = "Some"
} }
actual typealias <lineMarker>TypeAlias</lineMarker> = Some actual typealias <!LINE_MARKER("descr='Has declaration in common module'")!>TypeAlias<!> = Some
@@ -1,4 +1,4 @@
expect class <lineMarker>Header</lineMarker> { expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>Header<!> {
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1 +1 @@
actual typealias <lineMarker>Expected</lineMarker> = ExpectedImpl actual typealias <!LINE_MARKER("descr='Has declaration in common module'")!>Expected<!> = ExpectedImpl
@@ -1,11 +1,11 @@
expect class <lineMarker>Header</lineMarker> { expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>Header<!> {
fun <lineMarker>foo</lineMarker>(): Int fun <!LINE_MARKER("descr='Has actuals in JVM'")!>foo<!>(): Int
} }
expect class <lineMarker>Incomplete</lineMarker> { expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>Incomplete<!> {
fun foo(): Int fun foo(): Int
} }
expect fun <lineMarker>foo</lineMarker>(arg: Int): String expect fun <!LINE_MARKER("descr='Has actuals in JVM'")!>foo<!>(arg: Int): String
expect val <lineMarker>flag</lineMarker>: Boolean expect val <!LINE_MARKER("descr='Has actuals in JVM'")!>flag<!>: Boolean
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,11 +1,11 @@
actual class <lineMarker>Header</lineMarker> { actual class <!LINE_MARKER("descr='Has declaration in common module'")!>Header<!> {
actual fun <lineMarker>foo</lineMarker>() = 42 actual fun <!LINE_MARKER("descr='Has declaration in common module'")!>foo<!>() = 42
} }
actual class <lineMarker>Incomplete</lineMarker> actual class <!LINE_MARKER("descr='Has declaration in common module'")!>Incomplete<!>
actual fun <lineMarker>foo</lineMarker>(arg: Int) = arg.toString() actual fun <!LINE_MARKER("descr='Has declaration in common module'")!>foo<!>(arg: Int) = arg.toString()
actual val <lineMarker>flag</lineMarker> = true actual val <!LINE_MARKER("descr='Has declaration in common module'")!>flag<!> = true
@@ -1,5 +1,5 @@
expect class <lineMarker>WithCompanion</lineMarker> { expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>WithCompanion<!> {
companion <lineMarker>object</lineMarker> { companion <!LINE_MARKER("descr='Has actuals in JVM'")!>object<!> {
} }
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,4 +1,4 @@
expect annotation class <lineMarker>Ann</lineMarker>( expect annotation class <!LINE_MARKER("descr='Has actuals in JVM'")!>Ann<!>(
val <lineMarker>x</lineMarker>: Int, val <!LINE_MARKER("descr='Has actuals in JVM'")!>x<!>: Int,
val <lineMarker>y</lineMarker>: String val <!LINE_MARKER("descr='Has actuals in JVM'")!>y<!>: String
) )
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,3 +1,3 @@
expect class <lineMarker>NoConstructor2</lineMarker> { expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>NoConstructor2<!> {
fun <lineMarker>extraFun</lineMarker>() fun <!LINE_MARKER("descr='Has actuals in JVM'")!>extraFun<!>()
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,9 +1,9 @@
expect sealed class <lineMarker>Sealed</lineMarker> { expect sealed class <!LINE_MARKER("descr='Is subclassed by Sealed1 [common] Sealed1 in Sealed [jvm] Sealed2 [common] Sealed2 in Sealed [jvm]'"), LINE_MARKER("descr='Has actuals in JVM'")!>Sealed<!> {
object <lineMarker>Sealed1</lineMarker> : Sealed object <!LINE_MARKER("descr='Has actuals in JVM'")!>Sealed1<!> : Sealed
class <lineMarker>Sealed2</lineMarker> : Sealed { class <!LINE_MARKER("descr='Has actuals in JVM'")!>Sealed2<!> : Sealed {
val <lineMarker>x</lineMarker>: Int val <!LINE_MARKER("descr='Has actuals in JVM'")!>x<!>: Int
fun <lineMarker>foo</lineMarker>(): String fun <!LINE_MARKER("descr='Has actuals in JVM'")!>foo<!>(): String
} }
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,3 +1,3 @@
expect class <lineMarker>SecondaryConstructor</lineMarker>{ expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>SecondaryConstructor<!>{
<lineMarker>constructor</lineMarker>(name: String, surname: String) <!LINE_MARKER("descr='Has actuals in JVM'")!>constructor<!>(name: String, surname: String)
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,3 +1,3 @@
expect class <lineMarker>TypeAlias</lineMarker> { expect class <!LINE_MARKER("descr='Has actuals in JVM'")!>TypeAlias<!> {
val x: String val x: String
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,21 +1,21 @@
package test package test
open class <lineMarker>SimpleParent</lineMarker> { open class <!LINE_MARKER("descr='Is subclassed by ExpectedChild [common] ExpectedChild [jvm] ExpectedChildChild ExpectedChildChildJvm SimpleChild'")!>SimpleParent<!> {
open fun <lineMarker>foo</lineMarker>(n: Int) {} open fun <!LINE_MARKER("descr='Is overridden in test.ExpectedChild test.ExpectedChildChild test.ExpectedChildChildJvm test.SimpleChild'")!>foo<!>(n: Int) {}
open val <lineMarker>bar</lineMarker>: Int get() = 1 open val <!LINE_MARKER("descr='Is overridden in test.ExpectedChild test.ExpectedChildChild test.ExpectedChildChildJvm test.SimpleChild'")!>bar<!>: Int get() = 1
} }
expect open class <lineMarker><lineMarker>ExpectedChild</lineMarker></lineMarker> : SimpleParent { expect open class <!LINE_MARKER("descr='Is subclassed by ExpectedChildChild ExpectedChildChildJvm'"), LINE_MARKER("descr='Has actuals in JVM'")!>ExpectedChild<!> : SimpleParent {
override fun <lineMarker><lineMarker>foo</lineMarker></lineMarker>(n: Int) override fun <!LINE_MARKER("descr='Overrides function in 'SimpleParent''"), LINE_MARKER("descr='Has actuals in JVM'"), LINE_MARKER("descr='Is overridden in test.ExpectedChildChild test.ExpectedChildChildJvm'")!>foo<!>(n: Int)
override val <lineMarker><lineMarker>bar</lineMarker></lineMarker>: Int override val <!LINE_MARKER("descr='Overrides property in 'SimpleParent''"), LINE_MARKER("descr='Has actuals in JVM'"), LINE_MARKER("descr='Is overridden in test.ExpectedChildChild test.ExpectedChildChildJvm'")!>bar<!>: Int
} }
class ExpectedChildChild : ExpectedChild() { class ExpectedChildChild : ExpectedChild() {
override fun <lineMarker>foo</lineMarker>(n: Int) {} override fun <!LINE_MARKER("descr='Overrides function in 'ExpectedChild''")!>foo<!>(n: Int) {}
override val <lineMarker>bar</lineMarker>: Int get() = 1 override val <!LINE_MARKER("descr='Overrides property in 'ExpectedChild''")!>bar<!>: Int get() = 1
} }
class SimpleChild : SimpleParent() { class SimpleChild : SimpleParent() {
override fun <lineMarker>foo</lineMarker>(n: Int) {} override fun <!LINE_MARKER("descr='Overrides function in 'SimpleParent''")!>foo<!>(n: Int) {}
override val <lineMarker>bar</lineMarker>: Int get() = 1 override val <!LINE_MARKER("descr='Overrides property in 'SimpleParent''")!>bar<!>: Int get() = 1
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,21 +1,21 @@
package test package test
open class <lineMarker>SimpleParent</lineMarker> { open class <!LINE_MARKER("descr='Is subclassed by ExpectedChild [common] ExpectedChild [jvm] ExpectedChildChild ExpectedChildChildJvm SimpleChild'")!>SimpleParent<!> {
open fun <lineMarker>`foo fun`</lineMarker>(n: Int) {} open fun <!LINE_MARKER("descr='Is overridden in test.ExpectedChild test.ExpectedChildChild test.ExpectedChildChildJvm test.SimpleChild'")!>`foo fun`<!>(n: Int) {}
open val <lineMarker>`bar fun`</lineMarker>: Int get() = 1 open val <!LINE_MARKER("descr='Is overridden in test.ExpectedChild test.ExpectedChildChild test.ExpectedChildChildJvm test.SimpleChild'")!>`bar fun`<!>: Int get() = 1
} }
expect open class <lineMarker><lineMarker>ExpectedChild</lineMarker></lineMarker> : SimpleParent { expect open class <!LINE_MARKER("descr='Is subclassed by ExpectedChildChild ExpectedChildChildJvm'"), LINE_MARKER("descr='Has actuals in JVM'")!>ExpectedChild<!> : SimpleParent {
override fun <lineMarker><lineMarker>`foo fun`</lineMarker></lineMarker>(n: Int) override fun <!LINE_MARKER("descr='Overrides function in 'SimpleParent''"), LINE_MARKER("descr='Has actuals in JVM'"), LINE_MARKER("descr='Is overridden in test.ExpectedChildChild test.ExpectedChildChildJvm'")!>`foo fun`<!>(n: Int)
override val <lineMarker><lineMarker>`bar fun`</lineMarker></lineMarker>: Int override val <!LINE_MARKER("descr='Overrides property in 'SimpleParent''"), LINE_MARKER("descr='Has actuals in JVM'"), LINE_MARKER("descr='Is overridden in test.ExpectedChildChild test.ExpectedChildChildJvm'")!>`bar fun`<!>: Int
} }
class ExpectedChildChild : ExpectedChild() { class ExpectedChildChild : ExpectedChild() {
override fun <lineMarker>`foo fun`</lineMarker>(n: Int) {} override fun <!LINE_MARKER("descr='Overrides function in 'ExpectedChild''")!>`foo fun`<!>(n: Int) {}
override val <lineMarker>`bar fun`</lineMarker>: Int get() = 1 override val <!LINE_MARKER("descr='Overrides property in 'ExpectedChild''")!>`bar fun`<!>: Int get() = 1
} }
class SimpleChild : SimpleParent() { class SimpleChild : SimpleParent() {
override fun <lineMarker>`foo fun`</lineMarker>(n: Int) {} override fun <!LINE_MARKER("descr='Overrides function in 'SimpleParent''")!>`foo fun`<!>(n: Int) {}
override val <lineMarker>`bar fun`</lineMarker>: Int get() = 1 override val <!LINE_MARKER("descr='Overrides property in 'SimpleParent''")!>`bar fun`<!>: Int get() = 1
} }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1,11 +1,11 @@
package test package test
actual open class <lineMarker><lineMarker>ExpectedChild</lineMarker></lineMarker> : SimpleParent() { actual open class <!LINE_MARKER("descr='Is subclassed by ExpectedChildChildJvm'"), LINE_MARKER("descr='Has declaration in common module'")!>ExpectedChild<!> : SimpleParent() {
actual override fun <lineMarker><lineMarker><lineMarker>foo</lineMarker></lineMarker></lineMarker>(n: Int) {} actual override fun <!LINE_MARKER("descr='Overrides function in 'SimpleParent''"), LINE_MARKER("descr='Has declaration in common module'"), LINE_MARKER("descr='Is overridden in test.ExpectedChildChildJvm'")!>foo<!>(n: Int) {}
actual override val <lineMarker><lineMarker><lineMarker>bar</lineMarker></lineMarker></lineMarker>: Int get() = 1 actual override val <!LINE_MARKER("descr='Overrides property in 'SimpleParent''"), LINE_MARKER("descr='Has declaration in common module'"), LINE_MARKER("descr='Is overridden in test.ExpectedChildChildJvm'")!>bar<!>: Int get() = 1
} }
class ExpectedChildChildJvm : ExpectedChild() { class ExpectedChildChildJvm : ExpectedChild() {
override fun <lineMarker>foo</lineMarker>(n: Int) {} override fun <!LINE_MARKER("descr='Overrides function in 'ExpectedChild''")!>foo<!>(n: Int) {}
override val <lineMarker>bar</lineMarker>: Int get() = 1 override val <!LINE_MARKER("descr='Overrides property in 'ExpectedChild''")!>bar<!>: Int get() = 1
} }
@@ -1,5 +1,5 @@
interface <lineMarker>I</lineMarker> { interface <!LINE_MARKER("descr='Is implemented by KJs KJvm'")!>I<!> {
suspend fun <lineMarker descr="<html><body>Is implemented in <br>&nbsp;&nbsp;&nbsp;&nbsp;KJs<br>&nbsp;&nbsp;&nbsp;&nbsp;KJvm</body></html>">foo</lineMarker>(s: String) suspend fun <!LINE_MARKER("descr='Is implemented in KJs KJvm'")!>foo<!>(s: String)
} }
/* /*
@@ -0,0 +1,6 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
MODULE js { platform=[JS] }
jvm -> common { kind=DEPENDS_ON }
js -> common { kind=DEPENDS_ON }
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -1 +1 @@
expect fun <lineMarker descr="Has actuals in JVM">foo</lineMarker>(): Int expect fun <!LINE_MARKER("descr='Has actuals in JVM'")!>foo<!>(): Int
@@ -0,0 +1,6 @@
MODULE base_common { platform=[JVM, JS, Native] }
MODULE base_jvm { platform=[JVM] }
MODULE user_jvm { platform=[JVM] }
base_jvm -> base_common { kind=DEPENDS_ON }
user_jvm -> base_common { kind=DEPENDS_ON }
@@ -0,0 +1,6 @@
MODULE base_common { platform=[JVM, JS, Native] }
MODULE user_common { platform=[JVM, JS, Native] }
MODULE user_jvm { platform=[JVM] }
user_common -> base_common { kind=DEPENDS_ON }
user_jvm -> user_common { kind=DEPENDS_ON }
@@ -0,0 +1,3 @@
actual class <!LINE_MARKER("descr='Has declaration in common module'")!>Expected<!> {
actual val <!LINE_MARKER("descr='Has declaration in common module'")!>some<!> = Some()
}
@@ -1,3 +0,0 @@
actual class <lineMarker>Expected</lineMarker> {
actual val <lineMarker>some</lineMarker> = Some()
}
@@ -1,3 +1,3 @@
expect fun <lineMarker descr="Has actuals in JVM">foo</lineMarker>(): Int expect fun <!LINE_MARKER("descr='Has actuals in JVM'")!>foo<!>(): Int
expect fun <lineMarker descr="Has actuals in JVM">foo</lineMarker>(arg: Int): Int expect fun <!LINE_MARKER("descr='Has actuals in JVM'")!>foo<!>(arg: Int): Int
@@ -0,0 +1,4 @@
MODULE common { platform=[JVM, JS, Native] }
MODULE jvm { platform=[JVM] }
jvm -> common { kind=DEPENDS_ON }
@@ -5,22 +5,10 @@
package org.jetbrains.kotlin.idea.caches.resolve package org.jetbrains.kotlin.idea.caches.resolve
import org.jetbrains.kotlin.idea.multiplatform.setupMppProjectFromDirStructure import org.jetbrains.kotlin.idea.codeMetaInfo.AbstractLineMarkerCodeMetaInfoTest
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
import java.io.File
abstract class AbstractMultiModuleLineMarkerTest : AbstractMultiModuleHighlightingTest() { abstract class AbstractMultiModuleLineMarkerTest : AbstractLineMarkerCodeMetaInfoTest() {
override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/multiModuleLineMarker/" override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() + "/multiModuleLineMarker/"
override val shouldCheckLineMarkers = true
override val shouldCheckResult = false
override fun doTestLineMarkers() = true
protected fun doTest(path: String) {
setupMppProjectFromDirStructure(File(path))
checkLineMarkersInProject()
}
} }
@@ -29,7 +29,9 @@ import com.intellij.testFramework.runInEdtAndWait
import com.intellij.util.io.exists import com.intellij.util.io.exists
import gnu.trove.TIntArrayList import gnu.trove.TIntArrayList
import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest
import org.jetbrains.kotlin.checkers.diagnostics.DebugInfoDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.SyntaxErrorDiagnostic import org.jetbrains.kotlin.checkers.diagnostics.SyntaxErrorDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.factories.DebugInfoDiagnosticFactory0
import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil import org.jetbrains.kotlin.checkers.utils.CheckerTestUtil
import org.jetbrains.kotlin.checkers.utils.DiagnosticsRenderingConfiguration import org.jetbrains.kotlin.checkers.utils.DiagnosticsRenderingConfiguration
import org.jetbrains.kotlin.daemon.common.OSKind import org.jetbrains.kotlin.daemon.common.OSKind
@@ -49,9 +51,11 @@ import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest
import org.jetbrains.kotlin.idea.util.sourceRoots import org.jetbrains.kotlin.idea.util.sourceRoots
import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils
import org.junit.Ignore
import java.io.File import java.io.File
import java.nio.file.Paths import java.nio.file.Paths
@Ignore
class CodeMetaInfoTestCase( class CodeMetaInfoTestCase(
val codeMetaInfoTypes: Collection<AbstractCodeMetaInfoRenderConfiguration>, val codeMetaInfoTypes: Collection<AbstractCodeMetaInfoRenderConfiguration>,
val checkNoDiagnosticError: Boolean = false val checkNoDiagnosticError: Boolean = false
@@ -158,12 +162,11 @@ class CodeMetaInfoTestCase(
codeMetaInfo.platforms.add(OSKind.current.toString()) codeMetaInfo.platforms.add(OSKind.current.toString())
} }
} }
if (parsedMetaInfo.isNotEmpty()) parsedMetaInfo.forEach {
parsedMetaInfo.forEach { if (it.platforms.isNotEmpty() && OSKind.current.toString() !in it.platforms) codeMetaInfoForCheck.add(
if (it.platforms.isNotEmpty() && OSKind.current.toString() !in it.platforms) codeMetaInfoForCheck.add( it
it )
) }
}
val textWithCodeMetaInfo = CodeMetaInfoRenderer.renderTagsToText(codeMetaInfoForCheck, myEditor.document.text) val textWithCodeMetaInfo = CodeMetaInfoRenderer.renderTagsToText(codeMetaInfoForCheck, myEditor.document.text)
KotlinTestUtils.assertEqualsToFile( KotlinTestUtils.assertEqualsToFile(
expectedFile, expectedFile,
@@ -199,6 +202,11 @@ class CodeMetaInfoTestCase(
val diagnostic: AbstractDiagnostic<*> = diagnosticCodeMetaInfo.diagnostic val diagnostic: AbstractDiagnostic<*> = diagnosticCodeMetaInfo.diagnostic
diagnostic.factory.toString() in (highlightingCodeMetaInfo as HighlightingCodeMetaInfo).highlightingInfo.description diagnostic.factory.toString() in (highlightingCodeMetaInfo as HighlightingCodeMetaInfo).highlightingInfo.description
} }
is DebugInfoDiagnostic -> {
val diagnostic: DebugInfoDiagnostic = diagnosticCodeMetaInfo.diagnostic
diagnostic.factory == DebugInfoDiagnosticFactory0.MISSING_UNRESOLVED &&
"[DEBUG] Reference is not resolved to anything, but is not marked unresolved" in (highlightingCodeMetaInfo as HighlightingCodeMetaInfo).highlightingInfo.description
}
else -> throw java.lang.IllegalArgumentException("Unknown diagnostic type: ${diagnosticCodeMetaInfo.diagnostic}") else -> throw java.lang.IllegalArgumentException("Unknown diagnostic type: ${diagnosticCodeMetaInfo.diagnostic}")
} }
}, },
@@ -17,14 +17,17 @@ import org.jetbrains.kotlin.idea.codeMetaInfo.models.LineMarkerCodeMetaInfo
abstract class AbstractCodeMetaInfoRenderConfiguration(var renderParams: Boolean = true) { abstract class AbstractCodeMetaInfoRenderConfiguration(var renderParams: Boolean = true) {
private val clickOrPressRegex = "Click or press (.*)to navigate".toRegex() //We have different hotkeys on different platforms
open fun asString(codeMetaInfo: CodeMetaInfo) = codeMetaInfo.getTag() + getPlatformsString(codeMetaInfo) open fun asString(codeMetaInfo: CodeMetaInfo) = codeMetaInfo.getTag() + getPlatformsString(codeMetaInfo)
open fun getAdditionalParams(codeMetaInfo: CodeMetaInfo) = "" open fun getAdditionalParams(codeMetaInfo: CodeMetaInfo) = ""
protected fun sanitizeLineMarkerTooltip(originalText: String?): String { protected fun sanitizeLineMarkerTooltip(originalText: String?): String {
if (originalText == null) return "null" if (originalText == null) return "null"
val noHtmlTags = StringUtil.removeHtmlTags(originalText).replace(" ", "") val noHtmlTags = StringUtil.removeHtmlTags(originalText)
.replace(" ", "")
.replace(clickOrPressRegex, "")
.trim()
return sanitizeLineBreaks(noHtmlTags) return sanitizeLineBreaks(noHtmlTags)
} }
@@ -79,15 +82,16 @@ open class DiagnosticCodeMetaInfoRenderConfiguration(
} }
} }
open class LineMarkerRenderConfiguration(val renderDescription: Boolean = true) : AbstractCodeMetaInfoRenderConfiguration() { open class LineMarkerRenderConfiguration(var renderDescription: Boolean = true) : AbstractCodeMetaInfoRenderConfiguration() {
override fun asString(codeMetaInfo: CodeMetaInfo): String { override fun asString(codeMetaInfo: CodeMetaInfo): String {
if (codeMetaInfo !is LineMarkerCodeMetaInfo) return "" if (codeMetaInfo !is LineMarkerCodeMetaInfo) return ""
return getTag() + if (renderParams) "(\"${getParamsString(codeMetaInfo)}\")" else "" return getTag() + getParamsString(codeMetaInfo)
} }
fun getTag() = "LINE_MARKER" fun getTag() = "LINE_MARKER"
private fun getParamsString(lineMarkerCodeMetaInfo: LineMarkerCodeMetaInfo): String { private fun getParamsString(lineMarkerCodeMetaInfo: LineMarkerCodeMetaInfo): String {
if (!renderParams) return ""
val params = mutableListOf<String>() val params = mutableListOf<String>()
if (renderDescription) if (renderDescription)
@@ -95,7 +99,8 @@ open class LineMarkerRenderConfiguration(val renderDescription: Boolean = true)
params.add(getAdditionalParams(lineMarkerCodeMetaInfo)) params.add(getAdditionalParams(lineMarkerCodeMetaInfo))
return params.filter { it.isNotEmpty() }.joinToString("; ") val paramsString = params.filter { it.isNotEmpty() }.joinToString("; ")
return if (paramsString.isEmpty()) "" else "(\"$paramsString\")"
} }
} }
@@ -107,14 +112,15 @@ open class HighlightingRenderConfiguration(
override fun asString(codeMetaInfo: CodeMetaInfo): String { override fun asString(codeMetaInfo: CodeMetaInfo): String {
if (codeMetaInfo !is HighlightingCodeMetaInfo) return "" if (codeMetaInfo !is HighlightingCodeMetaInfo) return ""
return getTag() + if (renderParams) "(${getParamsString(codeMetaInfo)})" else "" return getTag() + getParamsString(codeMetaInfo)
} }
fun getTag() = "HIGHLIGHTING" fun getTag() = "HIGHLIGHTING"
private fun getParamsString(highlightingCodeMetaInfo: HighlightingCodeMetaInfo): String { private fun getParamsString(highlightingCodeMetaInfo: HighlightingCodeMetaInfo): String {
val params = mutableListOf<String>() if (!renderParams) return ""
val params = mutableListOf<String>()
if (renderSeverity) if (renderSeverity)
params.add("severity='${highlightingCodeMetaInfo.highlightingInfo.severity}'") params.add("severity='${highlightingCodeMetaInfo.highlightingInfo.severity}'")
if (renderDescription) if (renderDescription)
@@ -123,7 +129,8 @@ open class HighlightingRenderConfiguration(
params.add("textAttributesKey='${highlightingCodeMetaInfo.highlightingInfo.forcedTextAttributesKey}'") params.add("textAttributesKey='${highlightingCodeMetaInfo.highlightingInfo.forcedTextAttributesKey}'")
params.add(getAdditionalParams(highlightingCodeMetaInfo)) params.add(getAdditionalParams(highlightingCodeMetaInfo))
val paramsString = params.filter { it.isNotEmpty() }.joinToString("; ")
return params.filter { it.isNotEmpty() }.joinToString("; ") return if (paramsString.isEmpty()) "" else "(\"$paramsString\")"
} }
} }