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

Compiler crash after forgetting to enclose string in quotes #44007

Closed
SimonInman opened this issue Oct 30, 2020 · 2 comments
Closed

Compiler crash after forgetting to enclose string in quotes #44007

SimonInman opened this issue Oct 30, 2020 · 2 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. front-end-fasta-recovery P2 A bug or feature request we're likely to work on

Comments

@SimonInman
Copy link

SimonInman commented Oct 30, 2020

I just attempted to run the following code in DartPad. The code is wrong - I forgot to wrap the Date string in quotes in the final line. Nonetheless, the compiler should not crash.

void main() {
  var list = [
    DateTime.now().add(Duration(days: 3)),
    DateTime.now().add(Duration(days: 2)),
    DateTime.now(),
    DateTime.now().subtract(Duration(days: 1))
  ];

  list.sort((a, b) => a.compareTo(b));
  print(list);
  
  print(DateTime.parse(2019-01-17 00:00:00.000));

}

Dart SDK build number: 2.10.2
OS: Linux, using a proprietary Google corp version
I was opening https://dartpad.dartlang.org on Chrome

Full console output from DartPad included below:

Error compiling to JavaScript:
main.dart:12:35:
Error: Expected ',' before this.
  print(DateTime.parse(2019-01-17 00:00:00.000));
                                  ^^
main.dart:12:35:
Error: Expected an identifier, but got '00'.
  print(DateTime.parse(2019-01-17 00:00:00.000));
                                  ^^
main.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.10.2), 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 file:///tmp/dartpadZDTKLW/main.dart,
at character offset 10:
type 'ParserRecovery' is not a subtype of type 'Identifier'
#0      BodyBuilder.handleNamedArgument (package:front_end/src/fasta/kernel/body_builder.dart:4716:16)
#1      Parser.parseArgumentsRest (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5741:35)
#2      Parser.parseArguments (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5711:12)
#3      Parser.parseArgumentsOpt (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5692:14)
#4      Parser.parseSend (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5671:13)
#5      Parser.parseSendOrFunctionLiteral (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5398:12)
#6      Parser.parsePrimary (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4963:14)
#7      Parser.parsePrecedenceExpression (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4660:21)
#8      Parser.parseExpression (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4545:13)
#9      Parser.parseArgumentsRest (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5739:15)
#10     Parser.parseArguments (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5711:12)
#11     Parser.parseArgumentsOpt (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5692:14)
#12     Parser.parseSend (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5671:13)
#13     Parser.parseSendOrFunctionLiteral (package:_fe_analyzer_shared/src/parser/parser_impl.dart:5398:12)
#14     Parser.parsePrimary (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4963:14)
#15     Parser.parseUnaryExpression (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4870:12)
#16     Parser.parsePrecedenceExpression (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4604:13)
#17     Parser.parseExpression (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4545:13)
#18     Parser.parseExpressionStatement (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4510:13)
#19     Parser.parseExpressionStatementOrDeclarationAfterModifiers (package:_fe_analyzer_shared/src/parser/parser_impl.dart:6064:16)
#20     Parser.parseStatementX (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4306:14)
#21     Parser.parseStatement (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4296:20)
#22     Parser.parseFunctionBody (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4201:15)
#23     DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:990:14)
#24     DietListener.endTopLevelMethod (package:front_end/src/fasta/source/diet_listener.dart:358:5)
#25     Parser.parseTopLevelMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2743:14)
#26     Parser.parseTopLevelMemberImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2534:14)
#27     Parser.parseTopLevelDeclarationImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:501:14)
#28     Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:356:15)
#29     SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:427:14)
<asynchronous suspension>
#30     Loader.buildBodies (package:front_end/src/fasta/loader.dart:242:15)
#31     KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:382:20)
#32     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#33     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:380:12)
#34     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:177:38)
<asynchronous suspension>
#35     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart)
#36     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#37     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:73:10)
#38     compile.<anonymous closure> (package:front_end/src/api_unstable/dart2js.dart:192:43)
#39     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:135:20)
<asynchronous suspension>
#40     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart)
#41     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:46)
#42     new Future.sync (dart:async/future.dart:223:31)
#43     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:19)
#44     _rootRun (dart:async/zone.dart:1190:13)
#45     _CustomZone.run (dart:async/zone.dart:1093:19)
#46     _runZoned (dart:async/zone.dart:1630:10)
#47     runZoned (dart:async/zone.dart:1550:10)
#48     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#49     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:133:10)
#50     compile (package:front_end/src/api_unstable/dart2js.dart:190:57)
#51     KernelLoaderTask.load.<anonymous closure> (package:compiler/src/kernel/loader.dart:183:27)
<asynchronous suspension>
#52     KernelLoaderTask.load.<anonymous closure> (package:compiler/src/kernel/loader.dart)
#53     CompilerTask.measure (package:compiler/src/common/tasks.dart:66:51)
#54     KernelLoaderTask.load (package:compiler/src/kernel/loader.dart:60:12)
#55     Compiler.runInternal (package:compiler/src/compiler.dart:247:48)
#56     Compiler.run.<anonymous closure>.<anonymous closure> (package:compiler/src/compiler.dart:221:38)
#57     new Future.sync (dart:async/future.dart:223:31)
#58     Compiler.run.<anonymous closure> (package:compiler/src/compiler.dart:221:20)
#59     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#60     Compiler.run (package:compiler/src/compiler.dart:218:41)
#61     CompilerImpl.run.<anonymous closure>.<anonymous closure> (package:compiler/src/apiimpl.dart:96:22)
#62     _RootZone.runUnary (dart:async/zone.dart:1450:54)
#63     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#64     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#65     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#66     Future._completeWithValue (dart:async/future_impl.dart:529:5)
#67     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#68     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#69     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#70     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#71     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)


#0      DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:998:7)
#1      DietListener.endTopLevelMethod (package:front_end/src/fasta/source/diet_listener.dart:358:5)
#2      Parser.parseTopLevelMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2743:14)
#3      Parser.parseTopLevelMemberImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2534:14)
#4      Parser.parseTopLevelDeclarationImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:501:14)
#5      Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:356:15)
#6      SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:427:14)
<asynchronous suspension>
#7      Loader.buildBodies (package:front_end/src/fasta/loader.dart:242:15)
#8      KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:382:20)
#9      withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#10     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:380:12)
#11     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:177:38)
<asynchronous suspension>
#12     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart)
#13     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#14     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:73:10)
#15     compile.<anonymous closure> (package:front_end/src/api_unstable/dart2js.dart:192:43)
#16     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:135:20)
<asynchronous suspension>
#17     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart)
#18     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:46)
#19     new Future.sync (dart:async/future.dart:223:31)
#20     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:19)
#21     _rootRun (dart:async/zone.dart:1190:13)
#22     _CustomZone.run (dart:async/zone.dart:1093:19)
#23     _runZoned (dart:async/zone.dart:1630:10)
#24     runZoned (dart:async/zone.dart:1550:10)
#25     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#26     CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:133:10)
#27     compile (package:front_end/src/api_unstable/dart2js.dart:190:57)
#28     KernelLoaderTask.load.<anonymous closure> (package:compiler/src/kernel/loader.dart:183:27)
<asynchronous suspension>
#29     KernelLoaderTask.load.<anonymous closure> (package:compiler/src/kernel/loader.dart)
#30     CompilerTask.measure (package:compiler/src/common/tasks.dart:66:51)
#31     KernelLoaderTask.load (package:compiler/src/kernel/loader.dart:60:12)
#32     Compiler.runInternal (package:compiler/src/compiler.dart:247:48)
#33     Compiler.run.<anonymous closure>.<anonymous closure> (package:compiler/src/compiler.dart:221:38)
#34     new Future.sync (dart:async/future.dart:223:31)
#35     Compiler.run.<anonymous closure> (package:compiler/src/compiler.dart:221:20)
#36     CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#37     Compiler.run (package:compiler/src/compiler.dart:218:41)
#38     CompilerImpl.run.<anonymous closure>.<anonymous closure> (package:compiler/src/apiimpl.dart:96:22)
#39     _RootZone.runUnary (dart:async/zone.dart:1450:54)
#40     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#41     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#42     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#43     Future._completeWithValue (dart:async/future_impl.dart:529:5)
#44     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
#45     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#46     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#47     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#48     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

Thanks!

@devoncarew devoncarew added area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-fasta-recovery labels Oct 30, 2020
@devoncarew
Copy link
Member

Thanks for the report!

For later triagers note that this report is from dart 2.10.2.

@jensjoha jensjoha added crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. P2 A bug or feature request we're likely to work on labels Jun 15, 2021
@jensjoha
Copy link
Contributor

/cc @johnniwinther

@johnniwinther johnniwinther self-assigned this Jun 15, 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. crash Process exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash. front-end-fasta-recovery P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

4 participants