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
Dart2Js does not compile if static method is used as constant expression in annotations #17721
Comments
cc @johnniwinther. |
In the example the problem is that 'test' is not in scope. If you change 'test' to 'B.test' it compiles. |
This comment was originally written by markovuksanovi...@gmail.com Sorry for a bit delayed reply. I haven't noticed your reply. If this is the case, how come this compiles in dart itself? If it compiles in dart shouldn't it compile in dart2js too? |
This has to do with the liberal definition of "compile". The VM compiles things (functions, compile-time constants, ...) on demand. === |
This comment was originally written by markovuksan...@gmail.com Ok, but how to explain then the behavior in this pull request ( |
You are right. This is a bug in the VM (and now also in Angular). I filed issue #17795. |
This comment was originally written by markovuksan...@gmail.com Thanks for pointing this out. |
Added AsDesigned label. |
This issue was originally filed by markovuksa...@gmail.com
What steps will reproduce the problem?
class A {
final Function method;
const A({this.method});
}
@A(method: test)
class B {
static void test() {}
}
What is the expected output?
Dart2js compiles correctly (as it does using dart)
What do you see instead?
Error message:
web/packages/angular/routing/ng_view.dart:60:13: Warning: Cannot resolve 'initModule'.
module: initModule,
^^^^^^^^^^
web/packages/angular/routing/ng_view.dart:60:13: Error: Not a compile-time constant.
module: initModule,
^^^^^^^^^^
Error: Compilation failed.
Dart VM version: 1.2.0 (Tue Feb 25 07:31:27 2014) on "macos_x64"
The text was updated successfully, but these errors were encountered: