[FIR LT] Get correct startOffset value for declarations with comments

#KT-56913 Fixed
#KT-56926 Fixed
This commit is contained in:
Ivan Kylchik
2023-03-20 19:47:20 +01:00
committed by Space Team
parent e4591d7af9
commit 2b387e7a10
14 changed files with 414 additions and 6 deletions
+21
View File
@@ -0,0 +1,21 @@
// FILE: test.kt
fun box() {
A()
}
// Some comment
class A {
}
// EXPECTATIONS JVM JVM_IR
// test.kt:4 box
// test.kt:8 <init>
// test.kt:4 box
// test.kt:5 box
// EXPECTATIONS JS_IR
// test.kt:4 box
// test.kt:8 <init>
// test.kt:5 box
@@ -0,0 +1,26 @@
// FILE: test.kt
class AWithCompanion {
companion object {
//Comment before
val compPropVal = 1
}
}
fun box() {
AWithCompanion.compPropVal
}
// EXPECTATIONS JVM JVM_IR
// test.kt:11 box
// test.kt:6 <clinit>
// test.kt:6 getCompPropVal
// test.kt:6 getCompPropVal
// test.kt:11 box
// test.kt:12 box
// EXPECTATIONS JS_IR
// test.kt:11 box
// test.kt:6 <init>
// test.kt:4 <init>
// test.kt:12 box
@@ -0,0 +1,20 @@
// FILE: test.kt
// Comment before
fun foo(i: Int = 1): Int {
return i
}
fun box() {
foo()
}
// EXPECTATIONS JVM JVM_IR
// test.kt:9 box
// test.kt:5 foo
// test.kt:9 box
// test.kt:10 box
// EXPECTATIONS JS_IR
// test.kt:9 box
// test.kt:10 box
+54
View File
@@ -0,0 +1,54 @@
// FILE: test.kt
// Single line comment
fun box() {
A().foo()
A().bar()
}
/*
Multi
line
comment
*/
class A {
/**
* Doc
* comment
*/
fun foo() {
}
// Single line comment 1
// Single line comment 2
fun bar() {
}
}
// EXPECTATIONS JVM JVM_IR
// test.kt:5 box
// test.kt:15 <init>
// test.kt:5 box
// test.kt:24 foo
// test.kt:6 box
// test.kt:15 <init>
// test.kt:6 box
// test.kt:31 bar
// test.kt:7 box
// EXPECTATIONS JS_IR
// test.kt:5 box
// test.kt:15 <init>
// test.kt:5 box
// test.kt:24 foo
// test.kt:6 box
// test.kt:15 <init>
// test.kt:6 box
// test.kt:31 bar
// test.kt:7 box
@@ -0,0 +1,86 @@
// FILE: test.kt
interface MyInterfaceWithoutBreakpoints {
val propVal2: Int
var propVar2: Int
fun testPropertyInInterface() {
propVal2
propVar2
propVar2 = 2
}
}
// Breakpoint at GETFILED/PUTFIELD
class MyInterfaceImplWithBreakpoints : MyInterfaceWithoutBreakpoints {
//FieldWatchpoint! (propVal2)
override val propVal2 = 1
//FieldWatchpoint! (propVar2)
override var propVar2 = 1
fun testPropertyInInterfaceImpl() {
propVal2
propVar2
propVar2 = 2
}
}
fun box() {
val macwbi = MyInterfaceImplWithBreakpoints()
macwbi.testPropertyInInterface()
macwbi.testPropertyInInterfaceImpl()
}
// EXPECTATIONS JVM JVM_IR
// test.kt:30 box
// test.kt:15 <init>
// test.kt:17 <init>
// test.kt:20 <init>
// EXPECTATIONS JVM_IR
// test.kt:15 <init>
// EXPECTATIONS JVM JVM_IR
// test.kt:30 box
// test.kt:31 box
// test.kt:15 testPropertyInInterface
// test.kt:8 testPropertyInInterface
// test.kt:17 getPropVal2
// test.kt:8 testPropertyInInterface
// test.kt:9 testPropertyInInterface
// test.kt:20 getPropVar2
// test.kt:9 testPropertyInInterface
// test.kt:10 testPropertyInInterface
// test.kt:20 setPropVar2
// test.kt:11 testPropertyInInterface
// test.kt:15 testPropertyInInterface
// test.kt:32 box
// test.kt:23 testPropertyInInterfaceImpl
// test.kt:17 getPropVal2
// test.kt:23 testPropertyInInterfaceImpl
// test.kt:24 testPropertyInInterfaceImpl
// test.kt:20 getPropVar2
// test.kt:24 testPropertyInInterfaceImpl
// test.kt:25 testPropertyInInterfaceImpl
// test.kt:20 setPropVar2
// test.kt:26 testPropertyInInterfaceImpl
// test.kt:33 box
// EXPECTATIONS JS_IR
// test.kt:30 box
// test.kt:17 <init>
// test.kt:20 <init>
// test.kt:15 <init>
// test.kt:31 box
// test.kt:8 testPropertyInInterface
// test.kt:17 <get-propVal2>
// test.kt:9 testPropertyInInterface
// test.kt:20 <get-propVar2>
// test.kt:10 testPropertyInInterface
// test.kt:20 <set-propVar2>
// test.kt:20 <set-propVar2>
// test.kt:11 testPropertyInInterface
// test.kt:32 box
// test.kt:25 testPropertyInInterfaceImpl
// test.kt:26 testPropertyInInterfaceImpl
// test.kt:33 box