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

Cast error in StaticTypeAnalyzer #27543

Closed
bwilkerson opened this issue Oct 7, 2016 · 2 comments
Closed

Cast error in StaticTypeAnalyzer #27543

bwilkerson opened this issue Oct 7, 2016 · 2 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@bwilkerson
Copy link
Member

bwilkerson commented Oct 7, 2016

Dart analysis server, SDK version 1.20.0-dev.7.0, server version 1.17.0, error: Task failed: PartiallyResolveUnitReferencesTask for source x.dart
Unexpected exception while performing PartiallyResolveUnitReferencesTask for source x.dart
#0      AnalysisTask._safelyPerform (package:analyzer/task/model.dart:351)
#1      AnalysisTask.perform (package:analyzer/task/model.dart:238)
#2      AnalysisDriver.performWorkItem (package:analyzer/src/task/driver.dart:284)
#3      AnalysisDriver.performAnalysisTask (package:analyzer/src/task/driver.dart:255)
#4      AnalysisContextImpl.performAnalysisTask.<anonymous closure> (package:analyzer/src/context/context.dart:1243)
#5      _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:212)
#6      AnalysisContextImpl.performAnalysisTask (package:analyzer/src/context/context.dart:1241)
#7      PerformAnalysisOperation.perform (package:analysis_server/src/operation/operation_analysis.dart:355)
#8      AnalysisServer.performOperation (package:analysis_server/src/analysis_server.dart:893)
#9      Future.Future.<anonymous closure> (dart:async/future.dart:118)
#10     _rootRun (dart:async/zone.dart:1146)
#11     _CustomZone.run (dart:async/zone.dart:1026)
#12     _CustomZone.runGuarded (dart:async/zone.dart:924)
#13     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:951)
#14     _rootRun (dart:async/zone.dart:1150)
#15     _CustomZone.run (dart:async/zone.dart:1026)
#16     _CustomZone.runGuarded (dart:async/zone.dart:924)
#17     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:951)
#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 type 'TypeSystemImpl' is not a subtype of type 'StrongTypeSystemImpl' in type cast where
  TypeSystemImpl is from package:analyzer/src/generated/type_system.dart
  StrongTypeSystemImpl is from package:analyzer/src/generated/type_system.dart
#0      Object._as (dart:core-patch/object_patch.dart:74)
#1      StaticTypeAnalyzer.visitListLiteral (package:analyzer/src/generated/static_type_analyzer.dart:635)
#2      ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:6821)
#3      ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:6922)
#4      PartialResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:5284)
#5      UnifyingAstVisitor.visitListLiteral (package:analyzer/dart/ast/visitor.dart:3426)
#6      ResolverVisitor.visitListLiteral (package:analyzer/src/generated/resolver.dart:6842)
#7      ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:6821)
#8      VariableDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10756)
#9      ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:6920)
#10     PartialResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:5284)
#11     UnifyingAstVisitor.visitVariableDeclaration (package:analyzer/dart/ast/visitor.dart:3553)
#12     ScopedVisitor.visitVariableDeclaration (package:analyzer/src/generated/resolver.dart:8328)
#13     ResolverVisitor.visitVariableDeclaration (package:analyzer/src/generated/resolver.dart:7047)
#14     VariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:10750)
#15     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7728)
#16     VariableDeclarationListImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10848)
#17     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:6920)
#18     PartialResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:5284)
#19     UnifyingAstVisitor.visitVariableDeclarationList (package:analyzer/dart/ast/visitor.dart:3557)
#20     ResolverVisitor.visitVariableDeclarationList (package:analyzer/src/generated/resolver.dart:7073)
#21     VariableDeclarationListImpl.accept (package:analyzer/src/dart/ast/ast.dart:10842)
#22     TopLevelVariableDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10041)
#23     ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:6920)
#24     PartialResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:5284)
#25     UnifyingAstVisitor.visitTopLevelVariableDeclaration (package:analyzer/dart/ast/visitor.dart:3535)
#26     ResolverVisitor.visitTopLevelVariableDeclaration (package:analyzer/src/generated/resolver.dart:7031)
#27     PartialResolverVisitor.visitTopLevelVariableDeclaration (package:analyzer/src/generated/resolver.dart:5290)
#28     TopLevelVariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:10036)
#29     ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:6269)
#30     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2440)
#31     PartiallyResolveUnitReferencesTask.internalPerform (package:analyzer/src/task/dart.dart:4281)
#32     AnalysisTask._safelyPerform (package:analyzer/task/model.dart:339)
#33     AnalysisTask.perform (package:analyzer/task/model.dart:238)
#34     AnalysisDriver.performWorkItem (package:analyzer/src/task/driver.dart:284)
#35     AnalysisDriver.performAnalysisTask (package:analyzer/src/task/driver.dart:255)
#36     AnalysisContextImpl.performAnalysisTask.<anonymous closure> (package:analyzer/src/context/context.dart:1243)
#37     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:212)
#38     AnalysisContextImpl.performAnalysisTask (package:analyzer/src/context/context.dart:1241)
#39     PerformAnalysisOperation.perform (package:analysis_server/src/operation/operation_analysis.dart:355)
#40     AnalysisServer.performOperation (package:analysis_server/src/analysis_server.dart:893)
#41     Future.Future.<anonymous closure> (dart:async/future.dart:118)
#42     _rootRun (dart:async/zone.dart:1146)
#43     _CustomZone.run (dart:async/zone.dart:1026)
#44     _CustomZone.runGuarded (dart:async/zone.dart:924)
#45     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:951)
#46     _rootRun (dart:async/zone.dart:1150)
#47     _CustomZone.run (dart:async/zone.dart:1026)
#48     _CustomZone.runGuarded (dart:async/zone.dart:924)
#49     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:951)
#50     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:16)
#51     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:385)
#52     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:414)
#53     _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. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Oct 7, 2016
@bwilkerson bwilkerson assigned bwilkerson and unassigned bwilkerson Oct 7, 2016
@bwilkerson
Copy link
Member Author

This is a bigger issue than I first realized. We have an AnalysisContext in which the typeSystem has been set to a non-strong type system but for which the strongMode option is true. The most likely scenario I can think of for that happening is for the type system to be accessed before the option gets set, and then for the option to get set directly rather than through the analysisOptions setter. I have not found a code path that matches that scenario.

@jmesserly Any ideas? Is there value to caching the type system in the AnalysisContext, or should we re-compute it every time we need it? (Keeping in mind that this will be resolved when we move to Dart 2.0.)

@bwilkerson bwilkerson added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Nov 29, 2016
@bwilkerson
Copy link
Member Author

I'm assuming that this is stale.

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. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant