Skip to content

bug: constructor parameter members initialized in wrong order #1918

Closed
@trusktr

Description

@trusktr

Given the code

class Foo {
  c: number = this.a + this.b
  constructor(public a: number, public b: number) { }
}

const f = new Foo(1, 2)

the value of f.c should be 3, but it is 0.

This assemblyscript playground example shows 0.

This equivalent TypeScript playground example shows the expected 3.

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