Skip to content

usage of closure cannot be diagnosed in assignment statement #2749

Closed
@HerrCai0907

Description

@HerrCai0907

Bug description

usage of closure cannot be diagnosed in assignment statement

Steps to reproduce

compiler following code

function foo(): () => void {
  let a = 100;
  let bar = (): void => {
    a = 10;
    return;
  };
  return bar;
}

foo();

And then got validate error

[wasm-validator error in function assembly/index/foo~anonymous|0] unexpected false: local.set index must be small enough, on 
(local.set $0
 (i32.const 10)
)
FAILURE /Users/assemblyscript/cli/index.js:770
      return prepareResult(Error("validate error"));

AssemblyScript version

v0.27.x

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions