Skip to content

unsupported to call class static array field #355

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

Closed
LiaoPeng opened this issue Dec 1, 2018 · 0 comments
Closed

unsupported to call class static array field #355

LiaoPeng opened this issue Dec 1, 2018 · 0 comments

Comments

@LiaoPeng
Copy link
Contributor

LiaoPeng commented Dec 1, 2018

assemblyscript

class Container {
  static MONTHS_IN_YEAR: i32 = 12;
  static DAYS_IN_MONTH: i32[] = [31, 28, 31];
}
var months = Container.MONTHS_IN_YEAR;
var _days =  Container.DAYS_IN_MONTH[1];

Expected:
The expression var _days = Container.DAYS_IN_MONTH[1]; is ok.

In fact:

ERROR AS100: Operation not supported.
 var _days =  Container.DAYS_IN_MONTH[1];
@dcodeIO dcodeIO closed this as completed in 0e33806 Dec 1, 2018
willemneal pushed a commit to willemneal/assemblyscript that referenced this issue Dec 26, 2018
…ipt#355

This only affects static fields that currently must have a type annotation, while it wouldn't work if there wasn't an annotated type, like on normal globals, which aren't compiled lazily, though. Must be revisted if requirements on type annotations on fields ever become relaxed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant