[KT-4124] Add test case for nested/inner classes inside native class. Add diagnostic of inner classes inside native classes.

This commit is contained in:
Alexey Andreev
2016-02-15 17:55:31 +03:00
parent 040a646174
commit f5786dd567
17 changed files with 176 additions and 70 deletions
@@ -0,0 +1,31 @@
package foo
@native class A(x: Int) {
var x: Int
get() = noImpl
set(value) = noImpl
fun foo(): Int = noImpl
class B(val value: Int) {
fun bar(): Int = noImpl
}
inner class C(val value: Int) {
fun bar(): Int = noImpl
fun dec(): Unit = noImpl
}
}
fun box(): String {
var b = A.B(23)
if (b.bar() != 10023) return "failed1: ${b.bar()}"
var c = A(11).C(23)
if (c.bar() != 10034) return "failed2: ${c.bar()}"
c.dec()
if (c.bar() != 10033) return "failed3: ${c.bar()}"
return "OK"
}
@@ -0,0 +1,30 @@
function A(x) {
this.x = x;
}
A.prototype = {
foo : function() {
return this.x;
}
};
A.B = function(value) {
this.value = value;
};
A.B.prototype = {
bar : function() {
return 10000 + this.value;
}
};
A.C = function(outer, value) {
this.outer = outer;
this.value = value;
};
A.C.prototype = {
bar : function() {
return this.outer.foo() + this.value + 10000;
},
dec : function() {
this.outer.x--;
}
};