Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Missing docs: override doesn't do anything in @unmanaged classes #2973

Open
Labels
@geraintluff

Description

Bug description

If I have two classes, with an overridden method:

class A {
 foo() : i32 {
 return 1;
 }
}
class B extends A {
 override foo() : i32 {
 return 2;
 }
}
let bAsA : A = new B();
console.log(`foo = ${bAsA.foo()}`);

This logs foo = 2 as expected, because it looks up the correct method via the object's header.

However, if you mark both classes as @unmanaged, it logs foo = 1:

@unmanaged
class A {...}
@unmanaged
class B extends A {...}

This actual behaviour makes sense to me, since there aren't any fields in the C-style struct for the function pointers to be stored.

However, I think we should document this, and the compiler should also complain a bit when override is used in an @unmanaged class, to make it more obvious that it doesn't work.

Steps to reproduce

Run the code-examples above.

AssemblyScript version

v0.28.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /