dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.57k forks source link

Error compiling dartdevc module: #47176

Open bshlomo opened 3 years ago

bshlomo commented 3 years ago

Error compiling dartdevc module:std_web_store|lib/view/dialogs/order_details_wnd.unsound.ddc.js

We're sorry, you've found a bug in our compiler. You can report this bug at: https://github.com/dart-lang/sdk/issues/labels/web-dev-compiler Please include the information below in your report, along with any other information that may help us track it down. Thanks! -------------------- %< -------------------- dartdevc -k arguments: --dart-sdk-summary=C:\Program Files\Dart\dart-sdk/lib/_internal/ddc_sdk.dill --modules=amd --no-summarize -o C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\view\dialogs\order_details_wnd.unsound.ddc.js --source-map --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\meta\meta_meta.unsound.ddc.dill=packages/meta/meta_meta --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\meta\meta.unsound.ddc.dill=packages/meta/meta --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\shopisss_server\src\elements\command.unsound.ddc.dill=packages/shopisss_server/src/elements/command --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\http\src\boundary_characters.unsound.ddc.dill=packages/http/src/boundary_characters --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\pedantic\pedantic.unsound.ddc.dill=packages/pedantic/pedantic --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\utils.unsound.ddc.dill=packages/collection/src/utils --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\algorithms.unsound.ddc.dill=packages/collection/src/algorithms --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\iterable_zip.unsound.ddc.dill=packages/collection/src/iterable_zip --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\comparators.unsound.ddc.dill=packages/collection/src/comparators --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\priority_queue.unsound.ddc.dill=packages/collection/src/priority_queue --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\src\canonicalized_map.unsound.ddc.dill=packages/collection/src/canonicalized_map --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\collection\collection.unsound.ddc.dill=packages/collection/collection --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\typed_data\src\typed_buffer.unsound.ddc.dill=packages/typed_data/src/typed_buffer --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\typed_data\typed_buffers.unsound.ddc.dill=packages/typed_data/typed_buffers --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\typed_data\src\typed_queue.unsound.ddc.dill=packages/typed_data/src/typed_queue --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\charcode\ascii.unsound.ddc.dill=packages/charcode/ascii --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\charcode\html_entity.unsound.ddc.dill=packages/charcode/html_entity --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\charcode\charcode.unsound.ddc.dill=packages/charcode/charcode --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\path\path.unsound.ddc.dill=packages/path/path --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\term_glyph\src\generated\ascii_glyph_set.unsound.ddc.dill=packages/term_glyph/src/generated/ascii_glyph_set --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\source_span\source_span.unsound.ddc.dill=packages/source_span/source_span --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\string_scanner\src\eager_span_scanner.unsound.ddc.dill=packages/string_scanner/src/eager_span_scanner --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\http_parser\http_parser.unsound.ddc.dill=packages/http_parser/http_parser --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\http\http.unsound.ddc.dill=packages/http/http --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\shopisss_server\element_lib.unsound.ddc.dill=packages/shopisss_server/element_lib --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\shopisss_server\controller_lib.unsound.ddc.dill=packages/shopisss_server/controller_lib --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\he_text.unsound.ddc.dill=packages/client_app/model/language/he_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\date_symbols.unsound.ddc.dill=packages/intl/date_symbols --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\src\date_format_internal.unsound.ddc.dill=packages/intl/src/date_format_internal --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\number_symbols.unsound.ddc.dill=packages/intl/number_symbols --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\number_symbols_data.unsound.ddc.dill=packages/intl/number_symbols_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\clock\clock.unsound.ddc.dill=packages/clock/clock --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\src\intl\bidi.unsound.ddc.dill=packages/intl/src/intl/bidi --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\intl\intl.unsound.ddc.dill=packages/intl/intl --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\de_text.unsound.ddc.dill=packages/client_app/model/language/de_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\ar_text.unsound.ddc.dill=packages/client_app/model/language/ar_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\ru_text.unsound.ddc.dill=packages/client_app/model/language/ru_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\es_text.unsound.ddc.dill=packages/client_app/model/language/es_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\fr_text.unsound.ddc.dill=packages/client_app/model/language/fr_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\language\en_text.unsound.ddc.dill=packages/client_app/model/language/en_text --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\controller\ui_util.unsound.ddc.dill=packages/client_app/controller/ui_util --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\colors_for_msg.unsound.ddc.dill=packages/client_app/view/elements/colors_for_msg --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\callout_dlg.unsound.ddc.dill=packages/client_app/view/elements/callout_dlg --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\modal_box.unsound.ddc.dill=packages/client_app/view/elements/modal_box --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\elements\note_dlg.unsound.ddc.dill=packages/client_app/view/elements/note_dlg --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\product_data.unsound.ddc.dill=packages/client_app/model/data/product_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\sale_data.unsound.ddc.dill=packages/client_app/model/data/sale_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\view\store_app\elements\bread_crumb.unsound.ddc.dill=packages/client_app/view/store_app/elements/bread_crumb --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\controller\cmd_event_controller.unsound.ddc.dill=packages/client_app/controller/cmd_event_controller --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\view\elements\bread_crumb.unsound.ddc.dill=packages/std_web_store/view/elements/bread_crumb --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\model\content\base_content.unsound.ddc.dill=packages/std_web_store/model/content/base_content --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\supplier_data.unsound.ddc.dill=packages/client_app/model/data/supplier_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\tag_data.unsound.ddc.dill=packages/client_app/model/data/tag_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\model\data\group_data.unsound.ddc.dill=packages/client_app/model/data/group_data --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\view\elements\ui_parts.unsound.ddc.dill=packages/std_web_store/view/elements/ui_parts --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\client_app\controller\home_page_controller.unsound.ddc.dill=packages/client_app/controller/home_page_controller --summary=C:\Users\shlomob.L008717\AppData\Local\Temp\scratch_space7e54fab5\packages\std_web_store\model\content\brand_content.unsound.ddc.dill=packages/std_web_store/model/content/brand_content --packages=.dart_tool/package_config.json --module-name=packages/std_web_store/view/dialogs/order_details_wnd --multi-root-scheme=org-dartlang-app --multi-root=. --track-widget-creation --inline-source-map --libraries-file=file:///C:/Program%20Files/Dart/dart-sdk/lib/libraries.json --experimental-emit-debug-metadata --used-inputs-file=C:\Users\SHLOMO~1.L00\AppData\Local\Temp\ddk_builder_79e0363\used_inputs.txt package:std_web_store/view/dialogs/order_details_wnd.dart --no-sound-null-safety dart --version: 2.14.1 (stable) (Wed Sep 8 13:33:08 2021 +0200) on "windows_x64"

Crash when compiling null, at character offset null: Reference to package:std_web_store/view//elements/bread_crumb.dart is not bound to an AST node. A library was expected

0 Reference.asLibrary (package:kernel/canonical_name.dart:457:7)

1 LibraryDependency.targetLibrary (package:kernel/ast.dart:673:57)

2 SourceLoader.computeFullComponent (package:front_end/src/fasta/source/source_loader.dart:1051:38)

3 SourceLoader.computeHierarchy (package:front_end/src/fasta/source/source_loader.dart:1068:38)

4 KernelTarget.buildOutlines. (package:front_end/src/fasta/kernel/kernel_target.dart:333:14)

#5 withCrashReporting (package:front_end/src/fasta/crash.dart:121:12) #6 IncrementalCompiler.computeDelta. (package:front_end/src/fasta/incremental_compiler.dart:304:38) #7 _compile (package:dev_compiler/src/kernel/command.dart:341:32) #8 compile (package:dev_compiler/src/kernel/command.dart:51:12) #9 _CompilerWorker.performRequest (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:68:18) #10 AsyncWorkerLoop.run (package:bazel_worker/src/worker/async_worker_loop.dart:35:20) #11 main (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:31:5) #0 Reference.asLibrary (package:kernel/canonical_name.dart:457:7) #1 LibraryDependency.targetLibrary (package:kernel/ast.dart:673:57) #2 SourceLoader.computeFullComponent (package:front_end/src/fasta/source/source_loader.dart:1051:38) #3 SourceLoader.computeHierarchy (package:front_end/src/fasta/source/source_loader.dart:1068:38) #4 KernelTarget.buildOutlines. (package:front_end/src/fasta/kernel/kernel_target.dart:333:14) #5 withCrashReporting (package:front_end/src/fasta/crash.dart:121:12) #6 IncrementalCompiler.computeDelta. (package:front_end/src/fasta/incremental_compiler.dart:304:38) #7 _compile (package:dev_compiler/src/kernel/command.dart:341:32) #8 compile (package:dev_compiler/src/kernel/command.dart:51:12) #9 _CompilerWorker.performRequest (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:68:18) #10 AsyncWorkerLoop.run (package:bazel_worker/src/worker/async_worker_loop.dart:35:20) #11 main (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/dev_compiler/bin/dartdevc.dart:31:5)
nshahan commented 3 years ago

@johnniwinther This looks like it's coming from a call to IncrementalCompiler.computeDelta() on package:dev_compiler/src/kernel/command.dart:341:32. Are you aware of any recent changes that could be related?

Not sure if this is a red herring but I noticed the error message includes a path with an extra / in the middle. 'package:std_web_store/view//elements/bread_crumb.dart'.

johnniwinther commented 3 years ago

Maybe it's related to https://github.com/dart-lang/sdk/issues/46706

@jensjoha Can you take a look at this?

bshlomo commented 3 years ago

You are right The reason for the error is the extra / But I think this kind of error should have been discovered before the compiler stage

jensjoha commented 3 years ago

I've reproduced this (e47850a197c5d2522e67a1b8dd11427829ce6f04).

Caveat: The below has ended up in a semi-unstructured brain-dump, and I apologize, but will post it anyway.

This is what happens:

We've also seen this issue before with weird error messages like "Foo is not Foo" because a class "Foo" from lib "a/b/c.dart" is not a class "Foo" from lib "a/b//c.dart".

Furthermore this problem generalizes - at least on Windows - where "a/b/c.dart" and e.g. "a/b/C.dart" also yields the same file, but are two different URIs and thus becomes two different libraries.

In many ways this is equivalent to the build system not giving us all needed files, something we expect not to happen, which is why we (evidently) don't check for it. Maybe we should? (/cc @johnniwinther ) (I don't know how expensive that is). But also, at that point what are we actually supposed to do? I doubt we can actually give a good error message. (Maybe the part of the system that picks out the stuff that we want to serialize could give an error if given something we're not expecting? (say we're asked to compile "lib.dart" and given from dill a library "a/b/c.dart" and returned back "lib.dart", "a/b/c.dart" and "a/b//c.dart") --- but still this feels to late and can we get a good error message?).

Ideally we would give an error when importing the "wrong" version (say "a/b//c.dart" or "a/b/C.dart"), but how can we know if it's the wrong version? Can we define in the language that importing or exporting a uri with a double-slash is an error or a warning or something, and/or that if a program is importing and exporting something where two or more uris are duplicates in their lower-case-representation it's a warning or an error or something? (/cc @lrhn ) (on (most?) linux machines that could otherwise be a perfectly valid program).

Can we somehow from the filesystem extract what a "canonical" representation of the file identifier is? (so that we silently just rewrite the import).

What does the analyzer do in situations like this? (/cc @bwilkerson )

bshlomo commented 3 years ago

The analyzer ignored the problem and did not present the situation as a problem.

nshahan commented 3 years ago

@jensjoha If there is a solution here it sounds like it will be handled by the CFE. I'm going to move this to a different area label. If you think it should come back to the web please feel free to update it.

jensjoha commented 3 years ago

No one from the analyzer team has explained what the analyzer does in situations like this. That it doesn't crash for instance doesn't mean it's doing the right thing (whatever that might be). No one from the language team has explained what they'd expect happen in a situation like this, if there is a way to get the "canonical path" from the filesystem etc. In many ways this is (also) a failing of the build system --- it provides the CFE with what is basically invalid/incomplete data.

Having one "area" label here does not seem to do justice to the issue.

I'll try to /cc people again: @johnniwinther @bwilkerson @lrhn

lrhn commented 3 years ago

The current language specification is clear: If the URIs are different, they're defining different libraries. From the language's perspective, that's all there is to it. (It doesn't know about build systems or serialized code. It doesn't even know what a file system is, that's considered an implementation detail.)

I have a request for allowing the front-ends to be smarter about URIs in source code, but nothing has happened yet, so the specification stands.

That doesn't mean that tools can't be smarter about everything other than import URIs in source code. Command line paths is one case where we read something as either a URI or a file path, and it's perfectly reasonable to be clever about making that distinction (as long as all our tools agree on how to be clever). The language doesn't care how you get to the URI used for the entry point script, as long as it gets one. It cannot see whether the URI it gets matches the original text on the command line, and it won't care. We already do rewriting here, to make scripts in lib/ be inserted as package: URIs.

We can also choose to warn about any source URI containing double-slashes, or even any upper-case letters, because you really just shouldn't use those by accident.

So, from my perspective: Do whatever makes things work, as long as it's consistent.