Skip to content

need to support deferred libraries in VM / incremental compiler at least as noops #32245

Closed
@mraleph

Description

@mraleph

If you change flutter_gallery lib/main.dart into this:

import 'package:flutter/widgets.dart';

import 'gallery/app.dart' deferred as foo;

void main() {
  runApp(new foo.GalleryApp());
}

and try to run it in --preview-dart-2 mode then it explodes in both compiler and VM

[        ] compiler message: NoSuchMethodError: The getter 'dependencies' was called on null.
[        ] compiler message: Receiver: null
[        ] compiler message: Tried calling: dependencies
[        ] compiler message: #0      Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
[        ] compiler message: #1      BinaryBuilder.readLibraryDependencyReference (package:kernel/binary/ast_from_binary.dart:535)
[        ] compiler message: #2      BinaryBuilder.readExpression (package:kernel/binary/ast_from_binary.dart:1180)
[        ] compiler message: #3      BinaryBuilder.readExpressionOption (package:kernel/binary/ast_from_binary.dart:1168)
[        ] compiler message: #4      BinaryBuilder.readVariableDeclaration (package:kernel/binary/ast_from_binary.dart:1788)
[        ] compiler message: #5      BinaryBuilder.readExpression (package:kernel/binary/ast_from_binary.dart:1385)
[        ] compiler message: #6      BinaryBuilder.readExpressionList (package:kernel/binary/ast_from_binary.dart:1162)
[        ] compiler message: #7      BinaryBuilder.readArguments (package:kernel/binary/ast_from_binary.dart:1742)
[        ] compiler message: #8      BinaryBuilder.readExpression (package:kernel/binary/ast_from_binary.dart:1278)
[        ] compiler message: #9      BinaryBuilder.readStatement (package:kernel/binary/ast_from_binary.dart:1464)
[        ] compiler message: #10     BinaryBuilder.readStatementList (package:kernel/binary/ast_from_binary.dart:1442)
[        ] compiler message: #11     BinaryBuilder.readBlock (package:kernel/binary/ast_from_binary.dart:1606)
[        ] compiler message: #12     BinaryBuilder.readStatement (package:kernel/binary/ast_from_binary.dart:1466)
[        ] compiler message: #13     BinaryBuilder.readStatementOption (package:kernel/binary/ast_from_binary.dart:1457)
[        ] compiler message: #14     BinaryBuilder._setLazyLoadFunction.<anonymous closure> (package:kernel/binary/ast_from_binary.dart:1119)
[        ] compiler message: #15     FunctionNode._buildLazy (package:kernel/ast.dart:1918)
[        ] compiler message: #16     FunctionNode.body (package:kernel/ast.dart:1923)
[        ] compiler message: #17     BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:881)
[        ] compiler message: #18     FunctionNode.accept (package:kernel/ast.dart:1978)
[        ] compiler message: #19     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:220)
[        ] compiler message: #20     LimitedBinaryPrinter.writeNode (package:kernel/binary/limited_ast_to_binary.dart:55)
[        ] compiler message: #21     BinaryPrinter.writeOptionalNode (package:kernel/binary/ast_to_binary.dart:228)
[        ] compiler message: #22     BinaryPrinter.visitProcedure (package:kernel/binary/ast_to_binary.dart:770)
[        ] compiler message: #23     Procedure.accept (package:kernel/ast.dart:1640)
[        ] compiler message: #24     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:220)
[        ] compiler message: #25     LimitedBinaryPrinter.writeNode (package:kernel/binary/limited_ast_to_binary.dart:55)
[        ] compiler message: #26     BinaryPrinter.writeNodeList (package:kernel/binary/ast_to_binary.dart:212)
[        ] compiler message: #27     BinaryPrinter.visitLibrary (package:kernel/binary/ast_to_binary.dart:584)
[        ] compiler message: #28     Library.accept (package:kernel/ast.dart:409)
[        ] compiler message: #29     BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:220)
[        ] compiler message: #30     LimitedBinaryPrinter.writeNode (package:kernel/binary/limited_ast_to_binary.dart:55)
[        ] compiler message: #31     List.forEach (dart:core-patch/dart:core/growable_array.dart:274)
[        ] compiler message: #32     BinaryPrinter.writeList (package:kernel/binary/ast_to_binary.dart:204)
[        ] compiler message: #33     LimitedBinaryPrinter.writeLibraries (package:kernel/binary/limited_ast_to_binary.dart:49)
[        ] compiler message: #34     BinaryPrinter.writeProgramFile (package:kernel/binary/ast_to_binary.dart:300)
[        ] compiler message: #35     _FrontendCompiler.compile (package:frontend_server/server.dart:202)
[        ] compiler message: <asynchronous suspension>
[        ] compiler message: #36     starter.<anonymous closure> (package:frontend_server/server.dart:379)
[        ] compiler message: <asynchronous suspension>
[        ] compiler message: #37     _RootZone.runUnaryGuarded (dart:async/zone.dart:1316)
[        ] compiler message: #38     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
[        ] compiler message: #39     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
[        ] compiler message: #40     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68)
[        ] compiler message: #41     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15)
[        ] compiler message: #42     _StringAdapterSink.add (dart:convert/string_conversion.dart:268)
[        ] compiler message: #43     _LineSplitterSink._addLines (dart:convert/line_splitter.dart:154)
[        ] compiler message: #44     _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:129)
[        ] compiler message: #45     StringConversionSinkMixin.add (dart:convert/string_conversion.dart:189)
[        ] compiler message: #46     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120)
[        ] compiler message: #47     _RootZone.runUnaryGuarded (dart:async/zone.dart:1316)
[        ] compiler message: #48     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
[        ] compiler message: #49     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
[        ] compiler message: #50     _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68)
[        ] compiler message: #51     _EventSinkWrapper.add (dart:async/stream_transformers.dart:15)
[        ] compiler message: #52     _StringAdapterSink.add (dart:convert/string_conversion.dart:268)
[        ] compiler message: #53     _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:273)
[        ] compiler message: #54     _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:348)
[        ] compiler message: #55     _Utf8ConversionSink.add (dart:convert/string_conversion.dart:341)
[        ] compiler message: #56     _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:86)
[        ] compiler message: #57     _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120)
[        ] compiler message: #58     _RootZone.runUnaryGuarded (dart:async/zone.dart:1316)
[        ] compiler message: #59     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
[        ] compiler message: #60     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
[        ] compiler message: #61     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:763)
[        ] compiler message: #62     _StreamController._add (dart:async/stream_controller.dart:639)
[        ] compiler message: #63     _StreamController.add (dart:async/stream_controller.dart:585)
[        ] compiler message: #64     _Socket._onData (dart:io-patch/socket_patch.dart:1654)
[        ] compiler message: #65     _RootZone.runUnaryGuarded (dart:async/zone.dart:1316)
[        ] compiler message: #66     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330)
[        ] compiler message: #67     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257)
[        ] compiler message: #68     _StreamController&&_SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:763)
[        ] compiler message: #69     _StreamController._add (dart:async/stream_controller.dart:639)
[        ] compiler message: #70     _StreamController.add (dart:async/stream_controller.dart:585)
[        ] compiler message: #71     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1231)
[        ] compiler message: #72     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:784)
[        ] compiler message: #73     _microtaskLoop (dart:async/schedule_microtask.dart:41)
[        ] compiler message: #74     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
[        ] compiler message: #75     _runPendingImmediateCallback (dart:isolate-patch/dart:isolate/isolate_patch.dart:113)
[        ] compiler message: #76     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:166)
[  +34 ms] Updating files
[+1664 ms] DevFS: Sync finished
[        ] Synced 7.9MB.
[   +1 ms] _flutter.listViews: {}
[  +25 ms] Connected to _flutterView/0xe879e4a0.
[        ] 🔥  To hot reload your app on the fly, press "r". To restart the app entirely, press "R".
[        ] An Observatory debugger and profiler on Nexus 5X is available at: http://127.0.0.1:8108/
[        ] For a more detailed help message, press "h". To quit, press "q".
[+272225 ms] I/FlutterActivityDelegate(32520): onResume setting current activity to this
[ +543 ms] E/flutter (32520): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] error: Unsupported tag at this point: 14.
[        ] E/flutter (32520): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Dart_GetClosure expects argument 'library' to be non-null.
[+87581 ms] I/FlutterActivityDelegate(32036): onResume setting current activity to this
[  +48 ms] I/OpenGLRenderer(32036): Initialized EGL, version 1.4
[+1618 ms] I/FlutterActivityDelegate(32647): onResume setting current activity to this
[ +467 ms] E/flutter (32647): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] error: Unsupported tag at this point: 14.
[        ] E/flutter (32647): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Dart_GetClosure expects argument 'library' to be non-null.

Note: intl package generates code that contains deferred so there are Flutter apps in a wild that use deferred. If we don't have time to support deferred we should at least fix it to be a no-op when FlutterTarget is used.

This issue was revealed when I tried to run this Flutter application: https://github.com/brianegan/flutter_architecture_samples/tree/master/example/built_redux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions