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

Misplaced colon in a getter declaration crashes the analyzer #36961

DanTup opened this issue May 14, 2019 · 1 comment


None yet
3 participants
Copy link

commented May 14, 2019

Reported by @sarahec at Dart-Code/Dart-Code#1705. Reproduces on the current nightly build. (cc @bwilkerson @scheglov)

Dart release 2.3.0
Pedantic mode rules in effect

In VSCode, Android Studio, and on the command line, the Analyzer will terminate unexpectedly when it sees the following typo:

abstract class X {
  get checkpoint: // <<< This ":" is enough to crash the analyzer 

The stack trace is:

[11:55:46 GMT-0700 (PDT)] [General] [Error] [Analyzer] Captured exception
[11:55:46 GMT-0700 (PDT)] [General] [Error] [Analyzer] NoSuchMethodError: The getter 'parameters' was called on null.
Receiver: null
Tried calling: parameters
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1      _SummarizeAstVisitor.visitConstructorDeclaration (package:analyzer/src/summary/summarize_ast.dart:1075:36)
#2      ConstructorDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:2631:15)
#3      _SummarizeAstVisitor.serializeClass (package:analyzer/src/summary/summarize_ast.dart:428:16)
#4      _SummarizeAstVisitor.visitClassDeclaration (package:analyzer/src/summary/summarize_ast.dart:1032:5)
#5      ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1560:49)
#6      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7550:20)
#7      _SummarizeAstVisitor.serializeCompilationUnit (package:analyzer/src/summary/summarize_ast.dart:475:34)
#8      serializeAstUnlinked (package:analyzer/src/summary/summarize_ast.dart:22:8)
#9      FileState.refresh.<anonymous closure> (package:analyzer/src/dart/analysis/file_state.dart:476:46)
#10 (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#11     FileState.refresh (package:analyzer/src/dart/analysis/file_state.dart:475:26)
#12     FileTracker.verifyApiSignature.<anonymous closure> (package:analyzer/src/dart/analysis/file_tracker.dart:231:32)
#13 (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#14     FileTracker.verifyApiSignature (package:analyzer/src/dart/analysis/file_tracker.dart:227:20)
#15     FileTracker.verifyChangedFilesIfNeeded (package:analyzer/src/dart/analysis/file_tracker.dart:300:9)
#16     AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:1080:22)

This comment has been minimized.

Copy link

commented May 15, 2019

Looks like a parser recovery problem. This code get checkpoint: is parsed as a constructor, with different returnType than X, and no parameters.



@danrubel danrubel self-assigned this May 21, 2019

@dart-bot dart-bot closed this in add9565 May 22, 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.