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

NPE during inference #25972

Closed
bwilkerson opened this issue Mar 10, 2016 · 5 comments
Closed

NPE during inference #25972

bwilkerson opened this issue Mar 10, 2016 · 5 comments
Labels
analyzer-stability 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

@bwilkerson
Copy link
Member

Dart analysis server, SDK version 1.15.0-dev.0.0, server version 1.14.0, error: Task failed: PartiallyResolveUnitReferencesTask for source ...
Unexpected exception while performing PartiallyResolveUnitReferencesTask for source ...
#0      AnalysisTask._safelyPerform (package:analyzer/task/model.dart:328)
#1      AnalysisTask.perform (package:analyzer/task/model.dart:218)
#2      AnalysisDriver.performWorkItem (package:analyzer/src/task/driver.dart:274)
#3      AnalysisDriver.performAnalysisTask (package:analyzer/src/task/driver.dart:249)
#4      AnalysisContextImpl.performAnalysisTask.<anonymous closure> (package:analyzer/src/context/context.dart:1122)
#5      _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:194)
#6      AnalysisContextImpl.performAnalysisTask (package:analyzer/src/context/context.dart:1120)
#7      PerformAnalysisOperation.perform (package:analysis_server/src/operation/operation_analysis.dart:371)
#8      AnalysisServer.performOperation (package:analysis_server/src/analysis_server.dart:807)
#9      Future.Future.<anonymous closure> (dart:async/future.dart:118)
#10     _rootRun (dart:async/zone.dart:891)
#11     _CustomZone.run (dart:async/zone.dart:790)
#12     _CustomZone.runGuarded (dart:async/zone.dart:696)
#13     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:721)
#14     _rootRun (dart:async/zone.dart:895)
#15     _CustomZone.run (dart:async/zone.dart:790)
#16     _CustomZone.runGuarded (dart:async/zone.dart:696)
#17     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:721)
#18     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:16)
#19     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:385)
#20     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:414)
#21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)

Caused by The null object does not have a getter 'element'.

NoSuchMethodError: method not found: 'element'
Receiver: null
Arguments: []
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2      InferenceContext._matchTypes.match (package:analyzer/src/generated/resolver.dart:5587)
#3      InferenceContext._matchTypes.match (package:analyzer/src/generated/resolver.dart:5603)
#4      InferenceContext._matchTypes (package:analyzer/src/generated/resolver.dart:5629)
#5      InferenceContext.matchTypes (package:analyzer/src/generated/resolver.dart:5505)
#6      ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:9081)
#7      InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:5948)
#8      AstNodeImpl._safelyVisitChild (package:analyzer/src/dart/ast/ast.dart:935)
#9      VariableDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10449)
#10     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:9212)
#11     PartialResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:7665)
#12     UnifyingAstVisitor.visitVariableDeclaration (package:analyzer/dart/ast/visitor.dart:1844)
#13     ScopedVisitor.visitVariableDeclaration (package:analyzer/src/generated/resolver.dart:10757)
#14     ResolverVisitor.visitVariableDeclaration (package:analyzer/src/generated/resolver.dart:9328)
#15     VariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:10443)
#16     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7410)
#17     VariableDeclarationListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10544)
#18     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:9212)
#19     PartialResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:7665)
#20     UnifyingAstVisitor.visitVariableDeclarationList (package:analyzer/dart/ast/visitor.dart:1848)
#21     ResolverVisitor.visitVariableDeclarationList (package:analyzer/src/generated/resolver.dart:9354)
#22     VariableDeclarationListImpl.accept (package:analyzer/src/dart/ast/ast.dart:10538)
#23     AstNodeImpl._safelyVisitChild (package:analyzer/src/dart/ast/ast.dart:935)
#24     TopLevelVariableDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:9762)
#25     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:9212)
#26     PartialResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:7665)
#27     UnifyingAstVisitor.visitTopLevelVariableDeclaration (package:analyzer/dart/ast/visitor.dart:1826)
#28     ResolverVisitor.visitTopLevelVariableDeclaration (package:analyzer/src/generated/resolver.dart:9312)
#29     PartialResolverVisitor.visitTopLevelVariableDeclaration (package:analyzer/src/generated/resolver.dart:7672)
#30     TopLevelVariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:9757)
#31     ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:8610)
#32     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2360)
#33     PartiallyResolveUnitReferencesTask.internalPerform (package:analyzer/src/task/dart.dart:3718)
#34     AnalysisTask._safelyPerform (package:analyzer/task/model.dart:318)
#35     AnalysisTask.perform (package:analyzer/task/model.dart:218)
#36     AnalysisDriver.performWorkItem (package:analyzer/src/task/driver.dart:274)
#37     AnalysisDriver.performAnalysisTask (package:analyzer/src/task/driver.dart:249)
#38     AnalysisContextImpl.performAnalysisTask.<anonymous closure> (package:analyzer/src/context/context.dart:1122)
#39     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:194)
#40     AnalysisContextImpl.performAnalysisTask (package:analyzer/src/context/context.dart:1120)
#41     PerformAnalysisOperation.perform (package:analysis_server/src/operation/operation_analysis.dart:371)
#42     AnalysisServer.performOperation (package:analysis_server/src/analysis_server.dart:807)
#43     Future.Future.<anonymous closure> (dart:async/future.dart:118)
#44     _rootRun (dart:async/zone.dart:891)
#45     _CustomZone.run (dart:async/zone.dart:790)
#46     _CustomZone.runGuarded (dart:async/zone.dart:696)
#47     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:721)
#48     _rootRun (dart:async/zone.dart:895)
#49     _CustomZone.run (dart:async/zone.dart:790)
#50     _CustomZone.runGuarded (dart:async/zone.dart:696)
#51     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:721)
#52     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:16)
#53     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:385)
#54     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:414)
#55     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
@bwilkerson bwilkerson added P1 A high priority bug; for example, a single project is unusable or has many test failures area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-strong-mode analyzer-stability type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Mar 10, 2016
@jmesserly
Copy link

I'm guessing classTypeName.type is null, probably because the class name wasn't defined: List<int> x = new SomeUnknownName() ... I'll see if I can make a repro

@jmesserly
Copy link

Huh, I tried things like this:

class C<T> implements SomeUnknownName<T> {}
main() {
  C<int> x = new C();
}

Unfortunately it doesn't reproduce the problem (I may be on an older build). Here's a question -- how is it possible to get a null in the superclass/supermixin/superinterface chain? That seems like what's happening. Haven't gotten to dig in further.

@bwilkerson
Copy link
Member Author

That's probably the bug, but the most likely cause is invalid code, such as

class C<T> implements DoesNotExist {}

or even

class C<T> implements {}

@leafpetersen leafpetersen self-assigned this Mar 16, 2016
@leafpetersen leafpetersen removed their assignment Apr 5, 2016
@bwilkerson
Copy link
Member Author

I still don't know how to reproduce this, but it looks like we're getting to a point where t1 has a null superclass but isn't equal to the type for Object. I can't think of a way to get into that state, though.

@jmesserly
Copy link

I'm guessing this is stale? if not we can reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-stability 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

3 participants