Skip to content

Compiler: Type checks not performed on super calls #770

@Adolio

Description

@Adolio

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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions