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

prefer_spread_collections compiling error #36963

Closed
Cododoc opened this issue May 14, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@Cododoc
Copy link

commented May 14, 2019

I have a problem in build process.

I have warning 'prefer_spread_collections' on this code:

static final List<RouteDefinition> all = [
    info,
    persons,
    personCreate,
    personEdit
  ]
  ..addAll(PhoneAccountRoutes.all)
  ..addAll(CurrencyRoutes.all);

I change it to this one:

static final List<RouteDefinition> all = [
    info,
    persons,
    personCreate,
    personEdit,
    ...PhoneAccountRoutes.all,
    ...CurrencyRoutes.all
  ];

Running webdev build i got an error:

PS Z:\Web\Budget\Soy.Budget\Soy.Budget.UI> webdev build
[INFO] build_web_compilers:entrypoint on web/main.dart: Running dart2js with --minify --packages=.package-1ea07ce6ffe44210d1b294ffbe8cd536 -oweb/main.dart.js web/main.dart
[SEVERE] build_web_compilers:entrypoint on web/main.dart: Dart2Js finished with:

packages/budget/root_routes.dart:404:38:
Internal Error: The compiler crashed when compiling this element.
  static final List<RouteDefinition> all = [
                                     ^
The compiler is broken.

When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.

The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.

Please include the following information:

* the name and version of your operating system,

* the Dart SDK build number (2.3.0), and

* the entire message you see here (including the full stack trace
  below as well as the source location above).

The compiler crashed: NoSuchMethodError: The method 'add' was called on null.
Receiver: null
Tried calling: add(Instance of 'VariableDeclaration')
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1      StaticTypeVisitor.visitVariableDeclaration (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type.dart:1361:23)
#2      VariableDeclaration.accept (package:kernel/ast.dart:4647:35)
#3      StaticTypeBase.visitNode (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type_base.dart:76:18)
#4      StaticTypeVisitor.visitBlock (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type.dart:956:22)
#5      Block.accept (package:kernel/ast.dart:3941:35)
#6      StaticTypeBase.visitNode (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type_base.dart:76:18)
#7      StaticTypeVisitor.visitBlockExpression (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type.dart:928:5)
#8      BlockExpression.accept (package:kernel/ast.dart:3828:36)
#9      StaticTypeBase.visitNode (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type_base.dart:76:18)
#10     StaticTypeVisitor.visitLet (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type.dart:922:5)
#11     Let.accept (package:kernel/ast.dart:3797:36)
#12     StaticTypeBase.visitNode (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type_base.dart:76:18)
#13     StaticTypeVisitor.visitField (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/ir/static_type.dart:1352:5)
#14     Field.accept (package:kernel/ast.dart:1309:32)
#15     KernelToElementMapImpl.computeWorldImpact (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/kernel/element_map_impl.dart:1391:12)
#16     KernelWorkItem.run.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/kernel/kernel_strategy.dart:300:47)
#17     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#18     KernelWorkItem.run.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/kernel/kernel_strategy.dart:299:28)
#19     CompilerTask.measure (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:64:51)
#20     KernelWorkItem.run (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/kernel/kernel_strategy.dart:274:26)
#21     Compiler.emptyQueue.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:466:70)
#22     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#23     Compiler.emptyQueue.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:466:32)
#24     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#25     Compiler.emptyQueue.<anonymous closure>.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:464:28)
#26     CompilerDiagnosticReporter.withCurrentElement (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:784:15)
#27     Compiler.emptyQueue.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:462:18)
#28     ResolutionEnqueuer._forEach (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/enqueue.dart:445:12)
#29     ResolutionEnqueuer.forEach (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/enqueue.dart:461:5)
#30     Compiler.emptyQueue.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:458:16)
#31     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#32     Compiler.emptyQueue (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:457:14)
#33     Compiler.processQueue.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:483:7)
#34     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#35     Compiler.processQueue (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:476:14)
#36     Compiler.computeClosedWorld (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:336:5)
#37     Compiler.compileFromKernel.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:405:17)
#38     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#39     Compiler.compileFromKernel.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:404:43)
#40     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#41     Compiler.compileFromKernel (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:403:14)
#42     Compiler.runInternal (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:272:13)
<asynchronous suspension>
#43     Compiler.run.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:223:38)
#44     new Future.sync (dart:async/future.dart:224:31)
#45     Compiler.run.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:223:20)
#46     CompilerTask.measureSubtask (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/common/tasks.dart:179:35)
#47     Compiler.run (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/compiler.dart:220:41)
#48     CompilerImpl.run.<anonymous closure>.<anonymous closure> (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/compiler/lib/src/apiimpl.dart:91:22)
#49     _RootZone.runUnary (dart:async/zone.dart:1379:54)
#50     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#51     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#52     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#53     Future._completeWithValue (dart:async/future_impl.dart:483:5)
#54     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:513:7)
#55     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#56     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#57     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#58     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)


[INFO] Running build completed, took 35.1s
[INFO] Caching finalized dependency graph completed, took 283ms
[SEVERE] Failed after 35.4s
[SEVERE] 1

Dart VM version: 2.3.0 (Fri May 3 10:32:31 2019 +0200) on "windows_x64"
webdev 2.0.5
build_web_compilers "2.0.0"
build_runner "1.3.3"
build "0.3.2"

@sigmundch

This comment has been minimized.

Copy link
Member

commented May 17, 2019

Thanks for filing the issue and providing this great small repro case!

Turns out we have landed a fix in 9ac7bd7. This fix is available on the dev channel (2.3.1-dev.0.0), but it hasn't been released on the stable channel yet.

I went ahead and opened #36998 with a request to get this cherry-picked and released in the stable channel as well.

@sigmundch sigmundch closed this May 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.