Skip to content

Union types of 3 types fail silently #2870

Closed
@mimi89999

Description

@mimi89999

Bug description

When using union types of 3 types, asbuild does not report any errors, but the functions are not exported

Steps to reproduce

  1. Define a function accepting a parameter with a union type of 2 types. Notice that asc fails with an error:
ERROR AS100: Not implemented: union types
   :
 5 │ export function bar(a: i32 | u32): i32 {
   │                              ~~~
   └─ in assembly/index.ts(5,30)
  1. Now use a union type of 3 types like in the following code:
export function foo(a: aaa | bbb | ccc): i32 {
  return 1;
}

export function bar(a: i32 | u32 | f32): i32 {
  return 1;
}
  1. Run npm run asbuild
  2. Notice that the build succeeds, but the functions are not present in the wasm file. When compiling the code I pasted, I got an empty .wat file and a minimal .wasm file:
$ xxd build/release.wasm
00000000: 0061 736d 0100 0000 0503 0100 0007 0a01  .asm............
00000010: 066d 656d 6f72 7902 0000 2410 736f 7572  .memory...$.sour
00000020: 6365 4d61 7070 696e 6755 524c 122e 2f72  ceMappingURL../r
00000030: 656c 6561 7365 2e77 6173 6d2e 6d61 70    elease.wasm.map

AssemblyScript version

0.27.29

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions