[FIR JS] Support DEBUG_INFO_DYNAMIC

This commit is contained in:
Nikolay Lunyak
2023-01-04 12:20:10 +02:00
committed by Space Team
parent eed2fada1f
commit 95b589fd94
22 changed files with 263 additions and 204 deletions
@@ -3,8 +3,8 @@
fun withDynamicReceiver(d: dynamic.() -> Unit) {}
fun test() = withDynamicReceiver {
foo
bar = 1
<!DEBUG_INFO_DYNAMIC!>foo<!>
<!DEBUG_INFO_DYNAMIC!>bar<!> = 1
}
fun test2() = withDynamicReceiver(fun dynamic.() {})
@@ -12,6 +12,6 @@ fun test2() = withDynamicReceiver(fun dynamic.() {})
val dynamicProperty: dynamic.() -> Unit = TODO()
fun test(d: dynamic, dynamicParameter: dynamic.() -> Unit) {
d.dynamicProperty()
d.dynamicParameter()
d.<!DEBUG_INFO_DYNAMIC!>dynamicProperty<!>()
d.<!DEBUG_INFO_DYNAMIC!>dynamicParameter<!>()
}
@@ -2,8 +2,8 @@
fun test() {
dynamic {
foo()
bar.baz(0)
<!DEBUG_INFO_DYNAMIC!>foo<!>()
<!DEBUG_INFO_DYNAMIC!>bar<!>.<!DEBUG_INFO_DYNAMIC!>baz<!>(0)
}
}
@@ -2,43 +2,43 @@
// !MARK_DYNAMIC_CALLS
fun test(d: dynamic) {
+d
-d
! d
<!DEBUG_INFO_DYNAMIC!>+<!>d
<!DEBUG_INFO_DYNAMIC!>-<!>d
<!DEBUG_INFO_DYNAMIC!>!<!> d
d + d
d + 1
d <!DEBUG_INFO_DYNAMIC!>+<!> d
d <!DEBUG_INFO_DYNAMIC!>+<!> 1
"" + d
d - d
d * d
d / d
d % d
d <!DEBUG_INFO_DYNAMIC!>-<!> d
d <!DEBUG_INFO_DYNAMIC!>*<!> d
d <!DEBUG_INFO_DYNAMIC!>/<!> d
d <!DEBUG_INFO_DYNAMIC!>%<!> d
d and d
d <!DEBUG_INFO_DYNAMIC!>and<!> d
d[1]
<!DEBUG_INFO_DYNAMIC!>d[1]<!>
d[1] = 2
<!DEBUG_INFO_DYNAMIC!>d[1]<!> = 2
d[1]++
++d[1]
<!DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC!>d[1]<!><!DEBUG_INFO_DYNAMIC!>++<!>
<!DEBUG_INFO_DYNAMIC!>++<!><!DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC!>d[1]<!>
d[1]--
--d[1]
<!DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC!>d[1]<!><!DEBUG_INFO_DYNAMIC!>--<!>
<!DEBUG_INFO_DYNAMIC!>--<!><!DEBUG_INFO_DYNAMIC, DEBUG_INFO_DYNAMIC!>d[1]<!>
d()
d(1)
d(name = 1)
d <!VARARG_OUTSIDE_PARENTHESES!>{}<!>
<!DEBUG_INFO_DYNAMIC!>d()<!>
<!DEBUG_INFO_DYNAMIC!>d(1)<!>
<!DEBUG_INFO_DYNAMIC!>d(name = 1)<!>
<!DEBUG_INFO_DYNAMIC!>d <!VARARG_OUTSIDE_PARENTHESES!>{}<!><!>
class C {
val plus: dynamic = null
}
C() <!PROPERTY_AS_OPERATOR!>+<!> 5 // todo should be marked as DEBUG_INFO_DYNAMIC
C().plus(5)
C().<!DEBUG_INFO_DYNAMIC!>plus(5)<!>
d == d
d != d
@@ -46,37 +46,38 @@ fun test(d: dynamic) {
d === d
d !== d
d < d
d <= d
d >= d
d > d
d <!DEBUG_INFO_DYNAMIC!><<!> d
d <!DEBUG_INFO_DYNAMIC!><=<!> d
d <!DEBUG_INFO_DYNAMIC!>>=<!> d
d <!DEBUG_INFO_DYNAMIC!>><!> d
for (i in d) {
i.foo()
i.<!DEBUG_INFO_DYNAMIC!>foo<!>()
}
var dVar = d
dVar++
++dVar
dVar<!DEBUG_INFO_DYNAMIC!>++<!>
<!DEBUG_INFO_DYNAMIC!>++<!>dVar
dVar--
--dVar
dVar<!DEBUG_INFO_DYNAMIC!>--<!>
<!DEBUG_INFO_DYNAMIC!>--<!>dVar
dVar += 1
dVar -= 1
dVar *= 1
dVar /= 1
dVar %= 1
dVar <!DEBUG_INFO_DYNAMIC!>+=<!> 1
dVar <!DEBUG_INFO_DYNAMIC!>-=<!> 1
dVar <!DEBUG_INFO_DYNAMIC!>*=<!> 1
dVar <!DEBUG_INFO_DYNAMIC!>/=<!> 1
dVar <!DEBUG_INFO_DYNAMIC!>%=<!> 1
d += 1
d -= 1
d *= 1
d /= 1
d %= 1
d <!DEBUG_INFO_DYNAMIC!>+=<!> 1
d <!DEBUG_INFO_DYNAMIC!>-=<!> 1
d <!DEBUG_INFO_DYNAMIC!>*=<!> 1
d <!DEBUG_INFO_DYNAMIC!>/=<!> 1
d <!DEBUG_INFO_DYNAMIC!>%=<!> 1
d[1] += 1
d[1] -= 1
d[1] *= 1
d[1] /= 1
d[1] %= 1
<!DEBUG_INFO_DYNAMIC!>d[1]<!> <!DEBUG_INFO_DYNAMIC!>+=<!> 1
<!DEBUG_INFO_DYNAMIC!>d[1]<!> <!DEBUG_INFO_DYNAMIC!>-=<!> 1
<!DEBUG_INFO_DYNAMIC!>d[1]<!> <!DEBUG_INFO_DYNAMIC!>*=<!> 1
<!DEBUG_INFO_DYNAMIC!>d[1]<!> <!DEBUG_INFO_DYNAMIC!>/=<!> 1
<!DEBUG_INFO_DYNAMIC!>d[1]<!> <!DEBUG_INFO_DYNAMIC!>%=<!> 1
}
@@ -2,24 +2,24 @@
// !MARK_DYNAMIC_CALLS
fun test(d: dynamic) {
d.onAnyVal
d.onAnyVal = 1
d.<!DEBUG_INFO_DYNAMIC!>onAnyVal<!>
d.<!DEBUG_INFO_DYNAMIC!>onAnyVal<!> = 1
d?.onAnyVal
d?.onAnyVal = 1
d?.<!DEBUG_INFO_DYNAMIC!>onAnyVal<!>
d?.<!DEBUG_INFO_DYNAMIC!>onAnyVal<!> = 1
run {
d!!.onAnyVal
d!!.<!DEBUG_INFO_DYNAMIC!>onAnyVal<!>
}
run {
d!!.<!UNRESOLVED_REFERENCE!>onAnyVal<!> = 1
}
d.onNullableAnyVal = 1
d.<!DEBUG_INFO_DYNAMIC!>onNullableAnyVal<!> = 1
d.onStringVal = 1
d.<!DEBUG_INFO_DYNAMIC!>onStringVal<!> = 1
d.onDynamicVal = 1
d.<!DEBUG_INFO_DYNAMIC!>onDynamicVal<!> = 1
(d as String).onStringVal
(d as Any).onAnyVal
@@ -28,7 +28,7 @@ fun test(d: dynamic) {
}
fun testReassignmentWithSafeCall(d: dynamic) {
d?.onDynamicVal = 1
d?.<!DEBUG_INFO_DYNAMIC!>onDynamicVal<!> = 1
}
fun testReassignmentWithStaticCalls(d: dynamic) {
@@ -45,11 +45,11 @@ val dynamic.onDynamicVal: Int get() = 1
class C {
fun test(d: dynamic) {
d.memberVal
d.memberVal = 1
d.<!DEBUG_INFO_DYNAMIC!>memberVal<!>
d.<!DEBUG_INFO_DYNAMIC!>memberVal<!> = 1
d.memberExtensionVal
d.memberExtensionVal = 1
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVal<!>
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVal<!> = 1
}
val memberVal = 1
@@ -2,25 +2,25 @@
// !DIAGNOSTICS:-USELESS_CAST
fun test(d: dynamic) {
d.onAnyVar
d.onAnyVar = 1
d.<!DEBUG_INFO_DYNAMIC!>onAnyVar<!>
d.<!DEBUG_INFO_DYNAMIC!>onAnyVar<!> = 1
d?.onAnyVar
d?.onAnyVar = 1
d?.<!DEBUG_INFO_DYNAMIC!>onAnyVar<!>
d?.<!DEBUG_INFO_DYNAMIC!>onAnyVar<!> = 1
run {
d!!.onAnyVar
d!!.<!DEBUG_INFO_DYNAMIC!>onAnyVar<!>
}
run {
d!!.<!UNRESOLVED_REFERENCE!>onAnyVar<!> = 1
}
d.onNullableAnyVar = 1
d.<!DEBUG_INFO_DYNAMIC!>onNullableAnyVar<!> = 1
d.onStringVar = 1
d.<!DEBUG_INFO_DYNAMIC!>onStringVar<!> = 1
d.onDynamicVar = 1
d.<!DEBUG_INFO_DYNAMIC!>onDynamicVar<!> = 1
d?.<!UNRESOLVED_REFERENCE!>onDynamicVar<!> = 1
@@ -53,11 +53,11 @@ var dynamic.onDynamicVar: Int
class C {
fun test(d: dynamic) {
d.memberVar
d.memberExtensionVar
d.<!DEBUG_INFO_DYNAMIC!>memberVar<!>
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVar<!>
d.memberVar = 1
d.memberExtensionVar = 1
d.<!DEBUG_INFO_DYNAMIC!>memberVar<!> = 1
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVar<!> = 1
}
var memberVar = 1
@@ -2,18 +2,18 @@
// !MARK_DYNAMIC_CALLS
fun test(d: dynamic) {
d.onAny()
d?.onAny()
d.<!DEBUG_INFO_DYNAMIC!>onAny<!>()
d?.<!DEBUG_INFO_DYNAMIC!>onAny<!>()
run {
d!!.onAny()
d!!.<!DEBUG_INFO_DYNAMIC!>onAny<!>()
}
d.onAny(1)
d.<!DEBUG_INFO_DYNAMIC!>onAny<!>(1)
d.onNullableAny()
d.onString()
d.<!DEBUG_INFO_DYNAMIC!>onNullableAny<!>()
d.<!DEBUG_INFO_DYNAMIC!>onString<!>()
d.onDynamic()
d.<!DEBUG_INFO_DYNAMIC!>onDynamic<!>()
d?.<!UNRESOLVED_REFERENCE!>onDynamic<!>()
(d as String).onString()
@@ -29,8 +29,8 @@ fun dynamic.onDynamic() {}
class C {
fun test(d: dynamic) {
d.member()
d.memberExtension()
d.<!DEBUG_INFO_DYNAMIC!>member<!>()
d.<!DEBUG_INFO_DYNAMIC!>memberExtension<!>()
}
fun member() {}
@@ -1,34 +1,34 @@
// !MARK_DYNAMIC_CALLS
fun test(d: dynamic) {
d.onDynamic()
d.onNullableDynamic()
d.<!DEBUG_INFO_DYNAMIC!>onDynamic<!>()
d.<!DEBUG_INFO_DYNAMIC!>onNullableDynamic<!>()
d.valOnDynamic
d.valOnDynamic = 1
d.<!DEBUG_INFO_DYNAMIC!>valOnDynamic<!>
d.<!DEBUG_INFO_DYNAMIC!>valOnDynamic<!> = 1
d.varOnDynamic
d.varOnDynamic = 1
d.<!DEBUG_INFO_DYNAMIC!>varOnDynamic<!>
d.<!DEBUG_INFO_DYNAMIC!>varOnDynamic<!> = 1
}
fun dynamic.extTest() {
onDynamic()
onNullableDynamic()
<!DEBUG_INFO_DYNAMIC!>onDynamic<!>()
<!DEBUG_INFO_DYNAMIC!>onNullableDynamic<!>()
valOnDynamic
valOnDynamic = 1
<!DEBUG_INFO_DYNAMIC!>valOnDynamic<!>
<!DEBUG_INFO_DYNAMIC!>valOnDynamic<!> = 1
varOnDynamic
varOnDynamic = 1
<!DEBUG_INFO_DYNAMIC!>varOnDynamic<!>
<!DEBUG_INFO_DYNAMIC!>varOnDynamic<!> = 1
this.onDynamic()
this.onNullableDynamic()
this.<!DEBUG_INFO_DYNAMIC!>onDynamic<!>()
this.<!DEBUG_INFO_DYNAMIC!>onNullableDynamic<!>()
this.valOnDynamic
this.valOnDynamic = 1
this.<!DEBUG_INFO_DYNAMIC!>valOnDynamic<!>
this.<!DEBUG_INFO_DYNAMIC!>valOnDynamic<!> = 1
this.varOnDynamic
this.varOnDynamic = 1
this.<!DEBUG_INFO_DYNAMIC!>varOnDynamic<!>
this.<!DEBUG_INFO_DYNAMIC!>varOnDynamic<!> = 1
}
@@ -44,11 +44,11 @@ var dynamic.varOnDynamic: Int
class ForMemberExtensions {
fun test(d: dynamic) {
d.memberExtensionVar
d.memberExtensionVar = 1
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVar<!>
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVar<!> = 1
d.memberExtensionVal
d.memberExtensionVal = 1
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVal<!>
d.<!DEBUG_INFO_DYNAMIC!>memberExtensionVal<!> = 1
}
val dynamic.memberExtensionVal: Int get() = 1
@@ -1,26 +0,0 @@
// !MARK_DYNAMIC_CALLS
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> foo(t1: T, t2: T): T = t1
interface Tr
class C: Tr
fun <T: Tr> foo1(t1: T, t2: T): T = t1
fun test(d: dynamic, b: Boolean, n: String?) {
foo(d, "").foo()
foo1(d, C()).foo()
val fromIf = if (b) d else ""
fromIf.doo()
val fromElvis = n ?: d
fromElvis.doo()
}
class In<in T>(t: T)
fun <T> contra(a: In<T>, b: In<T>): T = null!!
fun testContra(d: dynamic) {
contra(In(d), In("")).get(0) // not a dynamic call
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !MARK_DYNAMIC_CALLS
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -23,4 +24,4 @@ fun <T> contra(a: In<T>, b: In<T>): T = null!!
fun testContra(d: dynamic) {
contra(In(d), In("")).get(0) // not a dynamic call
}
}
@@ -5,7 +5,7 @@ fun dynamic.foo(s: String, a: Any) {}
fun dynamic.foo(s: Any, a: String) {}
fun test(d: dynamic) {
d.foo(1, "")
d.foo("", "")
d.foo(1, 1)
d.<!DEBUG_INFO_DYNAMIC!>foo<!>(1, "")
d.<!DEBUG_INFO_DYNAMIC!>foo<!>("", "")
d.<!DEBUG_INFO_DYNAMIC!>foo<!>(1, 1)
}
@@ -1,12 +0,0 @@
// !MARK_DYNAMIC_CALLS
fun foo(d: dynamic) {
if (d is Foo) {
d.bar() // resolved statically
d.baz()
}
}
class Foo {
fun bar() {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !MARK_DYNAMIC_CALLS
fun foo(d: dynamic) {
@@ -2,26 +2,26 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun dynamic.test() {
foo()
ext()
<!DEBUG_INFO_DYNAMIC!>foo<!>()
<!DEBUG_INFO_DYNAMIC!>ext<!>()
bar()
this.bar()
this.<!DEBUG_INFO_DYNAMIC!>bar<!>()
baz = 2
this.baz = 2
this.<!DEBUG_INFO_DYNAMIC!>baz<!> = 2
"".ext()
ext()
<!DEBUG_INFO_DYNAMIC!>ext<!>()
"".extValFun()
extValFun()
<!DEBUG_INFO_DYNAMIC!>extValFun<!>()
"".extVal
extVal
<!DEBUG_INFO_DYNAMIC!>extVal<!>
baz.extExtVal()
extExtVal()
<!DEBUG_INFO_DYNAMIC!>extExtVal<!>()
""()
this()
@@ -29,7 +29,7 @@ fun dynamic.test() {
C() + C()
<!UNRESOLVED_REFERENCE!>+<!>C()
this + C()
this <!DEBUG_INFO_DYNAMIC!>+<!> C()
0.<!UNRESOLVED_REFERENCE!>missing<!>()
}
@@ -6,7 +6,7 @@ fun Any?.staticExtension() = 1
val Any?.staticProperty get() = 2
fun test(d: dynamic, staticParameter: Any?.() -> Unit) {
d.staticExtension()
d.staticProperty
d.staticParameter
d.<!DEBUG_INFO_DYNAMIC!>staticExtension<!>()
d.<!DEBUG_INFO_DYNAMIC!>staticProperty<!>
d.<!DEBUG_INFO_DYNAMIC!>staticParameter<!>
}
@@ -1,8 +0,0 @@
// !MARK_DYNAMIC_CALLS
fun foo(d: dynamic) {
Foo(d).p.bar()
}
class Foo<T>(val p: T)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !MARK_DYNAMIC_CALLS
fun foo(d: dynamic) {
@@ -8,6 +8,6 @@ fun test() {
fun v(<!FORBIDDEN_VARARG_PARAMETER_TYPE!>vararg<!> d: dynamic) {
for (dd in d) {
dd.foo()
dd.<!DEBUG_INFO_DYNAMIC!>foo<!>()
}
}
@@ -1,25 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class A {
fun get(index: Int): Char = '*'
}
abstract class B : A(), CharSequence
interface I {
fun nextChar(): Char
}
abstract class C : CharIterator(), I {
override fun nextChar(): Char = '*'
}
class CC(val s: CharSequence) : CharSequence by s, MyCharSequence {}
interface MyCharSequence {
val length: Int
operator fun get(index: Int): Char
fun subSequence(startIndex: Int, endIndex: Int): CharSequence
}