-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
The compiler crashed: NoSuchMethodError: The getter 'boxedVariables' was called on null. #47916
Comments
It is hard to guess where to start with this because the part that tells us where the error happened is not specific.
The first step might be to make this message a little more helpful. |
I re-run the command.
Log
And, also reproduced in 2.9.0-0.1.pre/2.16.0-80.1.beta. |
@rakudrama I believe to get additional info we probably need to land some changes in the compiler first. In particular,
Is likely due to how flutter tools are invoking dart2js. It's quite likely that they use the 2 step approach of first compiling to dill and then running the backend. I'm not sure if flutter tools provide a flag to bypass this mode (/cc @yjbanov ). Even if they do, I don't expect it to tell us more (other than report a different URI for the entrypoint of the application). I don't expect more info because the issue is coming up in a phase that is not recording which element was being processed when the error was encountered. We could however change the compiler to do so. At a glance, it appears there is an invariant broken where we expect every closure model converted to the JS world to have a non-null |
This should help investigation of #47916. Change-Id: I1db9d97e963593ab7f8778c8470328419633155d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226220 Reviewed-by: Sigmund Cherem <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
After the above change, it is likely that the error will show up with a source location. |
Thanks, I'll try it when the Dart version included in the latest Flutter master version is |
I've confirmed with Dart Log
It says the error occurs here: abstract class _Icon implements CategoryIcon {
const factory _Icon([String iconName]) = _$_Icon; // HERE!
factory _Icon.fromJson(Map<String, dynamic> json) = _$_Icon.fromJson;
String get iconName;
@JsonKey(ignore: true)
_$IconCopyWith<_Icon> get copyWith => throw _privateConstructorUsedError;
} That is internal huge Flutter project, so I tried to create reproduciable simple project, but it was succeeded to build 🤔 |
I've got the same issue. After changing the type of parameters to named ones and regenerating the freezed files, everything was compiled |
Thanks, that workaround also fixed my issue 👍 I keep this issue open since the problem is still unresolved. |
We are still working on trying to reproduce this, but haven't quite managed to. @DenisovAV - by chance do you have a small example we can use? @mono0926 - on your example:
|
Playing around with the patterns I saw in the generated code I was able to create a standalone repro: abstract class A {
const A._();
const factory A([String field]) = B;
}
abstract class B extends A {
const B._() : super._();
const factory B([String field]) = C;
String get field;
}
class C extends B {
const C([this.field = '']) : super._();
final String field;
}
main() {
A.new;
} This also crashes with the same error. /cc @rakudrama (edit: simplified the names of the classes in the repro) |
Nice repro. The debug version of dart2js crashes earlier with an assertion failure. |
Hi, I'm getting this error now, what should I do to fix this? Verbose Build Logs on Stable Channel
Verbose Build Logs on Dev Channel (actually beta since dev is gone now)
|
Thank you @sigmundch for being so thorough with this - Taking inspo from your comment, I removed all the |
@rakudrama - looking at the report from @Miiite in #48491, I noticed that the use of optional parameters was not relevant, then I noticed that the use of abstract class A {
const factory A() = B;
}
abstract class B implements A {
const factory B() = C;
}
class C implements B {
const C();
}
main() {
A.new;
} Any insights so far from the broken assertion? |
Experiencing the same issue, unable to find a fix for this. The error seems to suggest what @sigmundch has reproed.
|
In the Kernel IR, uses of a redirecting constructor are replaced by uses of the target. For the small example above, the IR is as follows. @johnniwinther It seems that the CFE should fully lower the feature or leave it in-place. Currently the K-model ignores redirecting construstors, so it seems that the intention was to fully lower.
|
It is an error in the lowering. I'll work on a fix. |
Hi @johnniwinther, Will this be included as hotfix? As I checked the latest version of dart in flutter master channel is 2.17.0-182.0.dev. But this commit is included in versions starting from 2.17.0-188.0.dev. Is there a way to change dart version in flutter sdk? |
The tear-off lowering for a redirecting factory called the immediate target (even when this was also a redirecting factory) instead of the effective target. This caused problem in backends that don't support redirecting factories directly. Closes #47916 Change-Id: I708c59dae9d210e0eb6dab4d01c6a044f6b2fd00
The tear-off lowering for a redirecting factory called the immediate target (even when this was also a redirecting factory) instead of the effective target. This caused problem in backends that don't support redirecting factories directly. Closes #47916 Change-Id: Iafb11c42c1e99e70ed44b0835473a8c69e995b01 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235780 Reviewed-by: Chloe Stefantsova <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
Hi, I have this problem with almost every flutter project I am creating. |
@timfong888 - thanks for letting us know. Note that the fix landed a few months ago and was subsequently cherry-picked into Dart and Flutter release channels, so all fixes have been available since Flutter 2.10.4. If you are on the latest version of Flutter and are seeing a similar error, it is quite possible it is caused by something else. If that's the case, could you file a new bug with more details so we can investigate? |
@sigmundch thanks for getting back. I am using CodeMagic to run the builds (the errors were the same as I was getting locally, but I thought a fresh VM each build would eliminate some environment issues). |
Run
flutter build web --target lib/main.dart
on my internal project, and the compiler crashes.Sorry, I couldn't make a reproducible public code.
Log:
This tracker is for issues related to:
The text was updated successfully, but these errors were encountered: