BowlerHatLLC / BowlerHatLLC/vscode-as3mxml

Compiler: Type checks not performed on `super` calls

Open
#770 4 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.