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

Analyzer crashes with new typedef + named arguments #30729

Closed
matanlurey opened this issue Sep 15, 2017 · 4 comments
Closed

Analyzer crashes with new typedef + named arguments #30729

matanlurey opened this issue Sep 15, 2017 · 4 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@matanlurey
Copy link
Contributor

Analyzer Feedback from IntelliJ

Version information

  • IDEA IU-171.4694.70
  • 1.25.0-dev.4.0
  • IU-171.4694.70, JRE 1.8.0_112-release-736-b21x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.12.6 unknown, screens 1440x900

Exception

Please append the contents of:
file:///private/var/folders/7z/ngj4xpds2tb_y6sy6v6mwl8h0000gn/T/report.txt

Dart analysis server, SDK version 1.25.0-dev.4.0, server version 1.18.1, error: Analysis failed: /Users/matan/git/din/lib/src/clients/ws_client.dart
NoSuchMethodError: The getter 'typeArguments' was called on null.
Receiver: null
Tried calling: typeArguments
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:43)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:47)
#2      ErrorVerifier._checkForMapTypeNotAssignable (package:analyzer/src/generated/error_verifier.dart:4568)
#3      ErrorVerifier.visitMapLiteral (package:analyzer/src/generated/error_verifier.dart:944)
#4      MapLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:7266)
#5      DefaultFormalParameterImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:3470)
#6      RecursiveAstVisitor.visitDefaultFormalParameter (package:analyzer/dart/ast/visitor.dart:755)
#7      ErrorVerifier.visitDefaultFormalParameter (package:analyzer/src/generated/error_verifier.dart:614)
#8      DefaultFormalParameterImpl.accept (package:analyzer/src/dart/ast/ast.dart:3465)
#9      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7990)
#10     FormalParameterListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4815)
#11     RecursiveAstVisitor.visitFormalParameterList (package:analyzer/dart/ast/visitor.dart:845)
#12     ErrorVerifier.visitFormalParameterList (package:analyzer/src/generated/error_verifier.dart:713)

Report

Dart analysis server, SDK version 1.25.0-dev.4.0, server version 1.18.1, error: Analysis failed: /Users/matan/git/din/lib/src/clients/ws_client.dart
NoSuchMethodError: The getter 'typeArguments' was called on null.
Receiver: null
Tried calling: typeArguments
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:43)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:47)
#2      ErrorVerifier._checkForMapTypeNotAssignable (package:analyzer/src/generated/error_verifier.dart:4568)
#3      ErrorVerifier.visitMapLiteral (package:analyzer/src/generated/error_verifier.dart:944)
#4      MapLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:7266)
#5      DefaultFormalParameterImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:3470)
#6      RecursiveAstVisitor.visitDefaultFormalParameter (package:analyzer/dart/ast/visitor.dart:755)
#7      ErrorVerifier.visitDefaultFormalParameter (package:analyzer/src/generated/error_verifier.dart:614)
#8      DefaultFormalParameterImpl.accept (package:analyzer/src/dart/ast/ast.dart:3465)
#9      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7990)
#10     FormalParameterListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:4815)
#11     RecursiveAstVisitor.visitFormalParameterList (package:analyzer/dart/ast/visitor.dart:845)
#12     ErrorVerifier.visitFormalParameterList (package:analyzer/src/generated/error_verifier.dart:713)
#13     FormalParameterListImpl.accept (package:analyzer/src/dart/ast/ast.dart:4811)
#14     GenericFunctionTypeImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:5739)
#15     RecursiveAstVisitor.visitGenericFunctionType (package:analyzer/dart/ast/visitor.dart:893)
#16     GenericFunctionTypeImpl.accept (package:analyzer/src/dart/ast/ast.dart:5732)
#17     GenericTypeAliasImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:5822)
#18     RecursiveAstVisitor.visitGenericTypeAlias (package:analyzer/dart/ast/visitor.dart:899)
#19     GenericTypeAliasImpl.accept (package:analyzer/src/dart/ast/ast.dart:5814)
#20     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7990)
#21     CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2502)
#22     RecursiveAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:707)
#23     ErrorVerifier.visitCompilationUnit (package:analyzer/src/generated/error_verifier.dart:540)
#24     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2495)
#25     LibraryAnalyzer._computeVerifyErrors (package:analyzer/src/dart/analysis/library_analyzer.dart:303)
#26     LibraryAnalyzer._analyze.<anonymous closure>.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:103)
#27     _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:356)
#28     LibraryAnalyzer._analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:102)
#29     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:200)
#30     LibraryAnalyzer._analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:101)

Here is the file, as I was typing it:

typedef WebSocketFactory = Future Function(String url, {Map<String, String> headers: const {}});
@matanlurey
Copy link
Contributor Author

When I wrote it the old way, I figured out that typedef's can't have default parameters :)

@bwilkerson bwilkerson added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Sep 15, 2017
@jmesserly
Copy link

this is a similar problem as #30596, we need to do error verification on the AST structure of the new function types, and reject old-style FunctionTypedFormalParameter, as well as DefaultFormalParameter. Probably can do this at the parser level.

@devoncarew devoncarew changed the title Analyzer still crashes with new typedef + named arguments Analyzer crashes with new typedef + named arguments Oct 3, 2017
@devoncarew
Copy link
Member

Just to update, I can still repro this from head.

@bwilkerson
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants