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

dart2js crash on missing function in list literal of function literals #46863

Closed
whesse opened this issue Aug 9, 2021 · 1 comment
Closed
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. dart2js-crash P2 A bug or feature request we're likely to work on

Comments

@whesse
Copy link
Contributor

whesse commented Aug 9, 2021

This crash occurred in dart2js from release x64 linux build of SDK from commit 9b586a3

When compiling the file reduced_test.dart containing only the text

final foo = [ () => const [], () => bar() ];

with the command

out/ReleaseX64/dart-sdk/bin/dart2js --sound-null-safety --out=out.js reduced_test.dart

I get a compiler crash. The crash also occurs without the --sound-null-safety flag, and also if the expression
is put within main() { }.

The entire crash message is

/src/dart/sdk$ out/ReleaseX64/dart-sdk/bin/dart2js reduced_test.dart 
reduced_test.dart:1:37:
Error: Method not found: 'bar'.
final foo = [ () => const [], () => bar() ];
                                    ^^^
reduced_test.dart:
Internal Error: The compiler crashed when compiling this element.

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.14.0-edge.9b586a3da6329669bf27abc05e3000cc53e87abd), and

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

The compiler crashed: Crash when compiling null,
at character offset null:
type 'InvalidType' is not a subtype of type 'InterfaceType' in type cast
#0      StandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:kernel/src/standard_bounds.dart:821:13)
#1      TypeSchemaStandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:front_end/src/fasta/type_inference/standard_bounds.dart:57:18)
#2      StandardBounds._getNullabilityAwareStandardUpperBound (package:kernel/src/standard_bounds.dart:626:12)
#3      StandardBounds._getNullabilityAwareFunctionStandardUpperBound (package:kernel/src/standard_bounds.dart:1198:27)
#4      StandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:kernel/src/standard_bounds.dart:743:16)
#5      TypeSchemaStandardBounds.getNullabilityAwareStandardUpperBoundInternal (package:front_end/src/fasta/type_inference/standard_bounds.dart:57:18)
#6      StandardBounds._getNullabilityAwareStandardUpperBound (package:kernel/src/standard_bounds.dart:626:12)
#7      StandardBounds.getStandardUpperBound (package:kernel/src/standard_bounds.dart:614:14)
#8      TypeSchemaEnvironment.addLowerBound (package:front_end/src/fasta/type_inference/type_schema_environment.dart:114:9)
#9      TypeSchemaConstraintGatherer.addLowerBound (package:front_end/src/fasta/type_inference/type_constraint_gatherer.dart:1055:17)
#10     TypeConstraintGatherer.computeConstraints (package:front_end/src/fasta/type_inference/type_constraint_gatherer.dart:70:9)
#11     TypeSchemaEnvironment.inferGenericFunctionOrType (package:front_end/src/fasta/type_inference/type_schema_environment.dart:288:39)
#12     InferenceVisitor.visitListLiteral (package:front_end/src/fasta/kernel/inference_visitor.dart:2001:38)
#13     ListLiteral.accept1 (package:kernel/ast.dart:7578:9)
#14     TypeInferrerImpl._inferExpression (package:front_end/src/fasta/type_inference/type_inferrer.dart:1964:27)
#15     TypeInferrerImpl.inferExpression (package:front_end/src/fasta/type_inference/type_inferrer.dart:1998:40)
#16     _ImplicitFieldTypeRoot.computeType (package:front_end/src/fasta/kernel/implicit_field_type.dart:154:55)
#17     SourceFieldBuilder.inferType (package:front_end/src/fasta/builder/field_builder.dart:476:47)
#18     SourceLoader.performTopLevelInference (package:front_end/src/fasta/source/source_loader.dart:1274:35)
#19     KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:335:14)
<asynchronous suspension>
#20     withCrashReporting (package:front_end/src/fasta/crash.dart:121:12)
<asynchronous suspension>
#21     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:101:10)
<asynchronous suspension>
#22     withCrashReporting (package:front_end/src/fasta/crash.dart:121:12)
<asynchronous suspension>
#23     compile.<anonymous closure> (package:front_end/src/api_unstable/dart2js.dart:201:37)
<asynchronous suspension>
#24     compile (package:front_end/src/api_unstable/dart2js.dart:199:36)
<asynchronous suspension>
#25     KernelLoaderTask.load.<anonymous closure> (package:compiler/src/kernel/loader.dart:179:21)
<asynchronous suspension>
#26     Compiler.runInternal (package:compiler/src/compiler.dart:282:29)
<asynchronous suspension>
@sigmundch sigmundch added area-front-end Use area-front-end for front end / CFE / kernel format related issues. and removed web-dart2js labels Aug 9, 2021
@sigmundch
Copy link
Member

FYI @stefantsov @johnniwinther, seems like a bug in the CFE's type inference.

@johnniwinther johnniwinther added the P2 A bug or feature request we're likely to work on label Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. dart2js-crash P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

4 participants