tests: Add test for AsTypeLate

This commit is contained in:
EmperorBale 2021-04-12 01:45:27 -07:00 committed by Mike Welsh
parent c0a56b14c0
commit 1d0c2b78b2
4 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,100 @@
package {
public class Test {
}
}
interface ITest2 {
function method();
function method2();
}
class Test2 implements ITest2 {
function Test2() {
}
public function method() {
trace("Instance method");
}
public function method2() {
trace("Instance method 2");
}
}
interface ITest3 extends ITest2 {
function method3()
}
class Test3 extends Test2 implements ITest3 {
function Test3() {
}
public override function method() {
trace("Child instance method pre-super");
super.method();
trace("Child instance method post-super");
}
public function method3() {
trace("Child instance method3 pre-super");
super.method();
trace("Child instance method3 post-super");
}
}
class Test4 extends Test3 {
function Test4() {
}
public override function method2() {
trace("Grandchild instance method2 pre-super");
super.method2();
trace("Grandchild instance method2 post-super");
}
public override function method3() {
trace("Grandchild instance method3 pre-super");
super.method3();
trace("Grandchild instance method3 post-super");
}
}
var x = new Test3();
trace("//x as Object");
trace(x as Object);
trace("//x as Test2");
trace(x as Test2);
trace("//x as ITest2");
trace(x as ITest2);
trace("//x as Test3");
trace(x as Test3);
trace("//x as ITest3");
trace(x as ITest3);
trace("//x as Test4");
trace(x as Test4);
var y = new Test4();
trace("//y as Object");
trace(y as Object);
trace("//y as Test2");
trace(y as Test2);
trace("//y as ITest2");
trace(y as ITest2);
trace("//y as Test3");
trace(y as Test3);
trace("//y as ITest3");
trace(y as ITest3);
trace("//y as Test4");
trace(y as Test4);

View File

@ -0,0 +1,24 @@
//x as Object
[object Test3]
//x as Test2
[object Test3]
//x as ITest2
[object Test3]
//x as Test3
[object Test3]
//x as ITest3
[object Test3]
//x as Test4
null
//y as Object
[object Test4]
//y as Test2
[object Test4]
//y as ITest2
[object Test4]
//y as Test3
[object Test4]
//y as ITest3
[object Test4]
//y as Test4
[object Test4]

Binary file not shown.

Binary file not shown.