BowlerHatLLC / BowlerHatLLC/vscode-as3mxml
Compiler: Type checks not performed on `super` calls
Open
bug
royale-dependency
royale-release-pending
- Dominant language
- Java
- Stars
- 282
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
Hi @joshtynjala,
I just noticed that the compiler is not performing type checks for `super` calls in constructors.
Having this would prevent runtime errors by detecting issues at compilation time.
The following code compiles fine but fails at runtime:
```as3
package
{
public class SuperTypeCheckTest
{
public function SuperTypeCheckTest()
{
new B();
}
}
}
import flash.geom.Point;
class A
{
public function A(point:Point)
{
}
}
class B extends A
{
public function B()
{
super(42); // TypeError: Error #1034: Type Coercion failed: cannot convert 42 to flash.geom.Point.
}
}
```
Best,
Aurélien
Contributor guide
Assessment
This issue has not been assessed yet.