Skip to content

[flash] unexpected runtime error with abstract and inlining #3178

Closed
@mandel59

Description

@mandel59

This code reproduce the issue where it is compiled into SWF.
Expected: a.g(0) returns the same value as a.f(0)
Result: a.g(0) throws TypeError: Error #1006

abstract A(String)
{
        public inline function new(s : String)
        {
                this = s;
        }

        public function f(index : Int) : Int
        {
                return StringTools.fastCodeAt(this, index);
        }

        public inline function g(index : Int) : Int
        {
                return StringTools.fastCodeAt(this, index);
        }
}

class Test
{
        public static function main()
        {
                try {
                        var a = new A("a");
                        trace(a.f(0));
                        trace(a.g(0));
                } catch (e : Dynamic) {
                        trace(e);
                }
        }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions