KT-2752: refactor NameSuggestion, change rules for determining name stability and applying mangling
This commit is contained in:
@@ -14,11 +14,9 @@ internal open class A(val a: Int) {
|
||||
internal class B(val b: Int) : A(b / 2) {
|
||||
override fun foo(i: Int): String = "B.foo($i: Int)"
|
||||
|
||||
fun boo(): String = "B.boo()"
|
||||
fun boo(i: String): String = "B.boo($i: String)"
|
||||
|
||||
fun bar(i: String): String = "B.bar($i: String)"
|
||||
fun bar(): String = "B.bar()"
|
||||
override fun baz(i: Int): String = "B.baz($i: Int)"
|
||||
fun bar(d: Double): String = "B.bar($d: Double)"
|
||||
}
|
||||
@@ -33,12 +31,10 @@ fun box(): String {
|
||||
if (b.foo(4) != "B.foo(4: Int)") return "b.foo(4) != \"B.foo(4: Int)\", it: ${b.foo(4)}"
|
||||
|
||||
if (b.boo(434) != "A.boo(434)") return "b.boo(434) != \"A.boo(434)\", it: ${b.boo(434)}"
|
||||
if (b.boo() != "B.boo()") return "b.boo() != \"B.boo()\", it: ${b.boo()}"
|
||||
if (b.boo("qlfj") != "B.boo(qlfj: String)") return "b.boo(\"qlfj\") != \"B.boo(qlfj: String)\", it: ${b.boo("qlfj")}"
|
||||
|
||||
if (b.bar("apl") != "B.bar(apl: String)") return "b.bar(\"apl\") != \"B.bar(apl: String)\", it: ${b.bar("apl")}"
|
||||
if (b.baz(34) != "B.baz(34: Int)") return "b.baz(34) != \"B.baz(34: Int)\", it: ${b.baz(34)}"
|
||||
if (b.bar() != "B.bar()") return "b.bar() != \"B.bar()\", it: ${b.bar()}"
|
||||
if (b.bar(2.213) != "B.bar(2.213: Double)") return "b.bar(2.213) != \"B.bar(2.213: Double)\", it: ${b.bar(2.213)}"
|
||||
|
||||
val a: A = b
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
function createA() {
|
||||
function ADerived() {
|
||||
}
|
||||
ADerived.prototype = Object.create(JS_TESTS.foo.A.prototype);
|
||||
ADerived.prototype.foo_za3lpa$ = function(n) {
|
||||
return 24;
|
||||
};
|
||||
return new ADerived();
|
||||
}
|
||||
|
||||
function createB() {
|
||||
function BDerived() {
|
||||
}
|
||||
BDerived.prototype = Object.create(JS_TESTS.foo.B.prototype);
|
||||
BDerived.prototype.bar_za3lpa$ = function(n) {
|
||||
return this.foo_za3lpa$(n);
|
||||
};
|
||||
return new BDerived();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package foo
|
||||
|
||||
open class A {
|
||||
open protected fun foo(n: Int) = 23
|
||||
|
||||
fun bar(n: Int) = foo(n) + 100
|
||||
}
|
||||
|
||||
open class B {
|
||||
protected fun foo(n: Int) = 42
|
||||
|
||||
open fun bar(n: Int) = 142
|
||||
}
|
||||
|
||||
@native fun createA(): A
|
||||
|
||||
@native fun createB(): B
|
||||
|
||||
fun box(): String {
|
||||
val a = createA()
|
||||
if (a.bar(0) != 124) return "fail1: ${a.bar(0)}"
|
||||
|
||||
val b = createB()
|
||||
if (b.bar(0) != 42) return "fail2: ${b.bar(0)}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -3,5 +3,5 @@ function A(v) {
|
||||
}
|
||||
|
||||
function nativeBox(b) {
|
||||
return b.bar_0(new A("foo"), function(i, s) { return "" + this.v + s + i })
|
||||
return b.bar_asnz92$(new A("foo"), function(i, s) { return "" + this.v + s + i })
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ fun box(): String {
|
||||
|
||||
val b: dynamic = object {val bar = ""}
|
||||
assertEquals(b.foo, undefined)
|
||||
assertNotEquals(b.bar_0, undefined)
|
||||
assertNotEquals(b.bar, undefined)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user