Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong location for certain errors #2852

Open
mattjohnsonpint opened this issue Jun 17, 2024 · 1 comment
Open

Wrong location for certain errors #2852

mattjohnsonpint opened this issue Jun 17, 2024 · 1 comment
Labels

Comments

@mattjohnsonpint
Copy link
Contributor

mattjohnsonpint commented Jun 17, 2024

Bug description

For certain common errors, such as accessing an array index that is out of bounds, the error message returned shows the location of the error in the standard library rather than the location of the code that caused the error.

Steps to reproduce

Consider this user code, in a file at /assembly/index.ts:

export function test(): i32 {
  const a: i32[] = [0, 1, 2];
  const i = a[3]; // error should occur here
  return i;
}

When invoked by the host, the error given is:

abort: Index out of range in ~lib/array.ts(114:42)

Which is here, but IMHO not very useful.

I would expect:

abort: Index out of range in index.ts(3:15)

AssemblyScript version

v0.27.27

@JesseCodeBones
Copy link
Contributor

I suppose [] is mutable in AS, it is hard to do the static check during compile phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants