Skip to content

Inlined constructor compile failed #3050

Description

@hungryzzz

Bug description

// bad.ts
class A {
  s: string;

  @inline
  constructor() {
    this.s = "";
    let copy = this.s;
  }
}

export function main(): void {
  new A();
}

Steps to reproduce

> node ~/fuzz_emerging_compilers/AssemblyScript/assemblyscript/bin/asc --optimizeLevel 2 --shrinkLevel 2 bad.ts -o bad.wasm

ERROR TS2564: Property 'bad/A#s' has no initializer and is not assigned in the constructor before 'this' is used or returned.
   :
 2 │ s: string;
   │ ~
   └─ in bad.ts(2,3)
   :
 7 │ let copy = this.s;
   │            ~~~~~~
   └─ in bad.ts(7,16)

FAILURE 1 compile error(s)

AssemblyScript version

b6bda05

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions