dartdoc
dartdoc copied to clipboard
dartdoc failed: type 'PropertyAccessImpl' is not a subtype of type 'IdentifierImpl' in type cast
Result of running dart doc .
:
Documenting omnilore_scheduler... |
dartdoc 4.1.0 (.../omnilore_scheduler/dartdev) failed: type 'PropertyAccessImpl' is not a subtype of type 'IdentifierImpl' in type cast
#0 CommentReferenceImpl.identifier (package:analyzer/src/dart/ast/ast.dart:1911:48)
#1 new _ModelCommentReferenceImpl (package:dartdoc/src/comment_references/model_comment_reference.dart:101:29)
#2 new ModelCommentReference (package:dartdoc/src/comment_references/model_comment_reference.dart:24:7)
#3 ModelNode._commentRefsFor (package:dartdoc/src/model/model_node.dart:30:11)
#4 new ModelNode (package:dartdoc/src/model/model_node.dart:22:23)
#5 PackageGraph.populateModelNodeFor.<anonymous closure> (package:dartdoc/src/model/package_graph.dart:174:15)
#6 _LinkedHashMapMixin.putIfAbsent (dart:collection-patch/compact_hash.dart:453:23)
#7 PackageGraph.populateModelNodeFor (package:dartdoc/src/model/package_graph.dart:172:17)
#8 new Library.fromLibraryResult.<anonymous closure> (package:dartdoc/src/model/library.dart:82:26)
#9 _HashableChildLibraryElementVisitor.visitElement (package:dartdoc/src/model/library.dart:34:21)
#10 GeneralizingElementVisitor.visitExecutableElement (package:analyzer/dart/element/visitor.dart:101:59)
#11 GeneralizingElementVisitor.visitMethodElement (package:analyzer/dart/element/visitor.dart:151:7)
#12 MethodElementImpl.accept (package:analyzer/src/dart/element/element.dart:4323:54)
#13 ElementImpl.safelyVisitChildren (package:analyzer/src/dart/element/element.dart:2587:13)
#14 ClassElementImpl.visitChildren (package:analyzer/src/dart/element/element.dart:804:5)
#15 GeneralizingElementVisitor.visitElement (package:analyzer/dart/element/visitor.dart:97:13)
#16 _HashableChildLibraryElementVisitor.visitElement (package:dartdoc/src/model/library.dart:35:11)
#17 GeneralizingElementVisitor.visitClassElement (package:analyzer/dart/element/visitor.dart:86:49)
#18 AbstractClassElementImpl.accept (package:analyzer/src/dart/element/element.dart:126:54)
#19 ElementImpl.safelyVisitChildren (package:analyzer/src/dart/element/element.dart:2587:13)
#20 CompilationUnitElementImpl.visitChildren (package:analyzer/src/dart/element/element.dart:1228:5)
#21 GeneralizingElementVisitor.visitElement (package:analyzer/dart/element/visitor.dart:97:13)
#22 _HashableChildLibraryElementVisitor.visitElement (package:dartdoc/src/model/library.dart:35:11)
#23 GeneralizingElementVisitor.visitCompilationUnitElement (package:analyzer/dart/element/visitor.dart:90:7)
#24 CompilationUnitElementImpl.accept (package:analyzer/src/dart/element/element.dart:1190:15)
#25 ElementImpl.safelyVisitChildren (package:analyzer/src/dart/element/element.dart:2587:13)
#26 LibraryElementImpl.visitChildren (package:analyzer/src/dart/element/element.dart:4169:5)
#27 GeneralizingElementVisitor.visitElement (package:analyzer/dart/element/visitor.dart:97:13)
#28 _HashableChildLibraryElementVisitor.visitElement (package:dartdoc/src/model/library.dart:35:11)
#29 new Library.fromLibraryResult (package:dartdoc/src/model/library.dart:83:10)
#30 PackageGraph.addLibraryToGraph (package:dartdoc/src/model/package_graph.dart:72:23)
#31 PubPackageBuilder._parseLibraries (package:dartdoc/src/model/package_builder.dart:225:23)
<asynchronous suspension>
#32 PubPackageBuilder.getLibraries (package:dartdoc/src/model/package_builder.dart:404:5)
<asynchronous suspension>
#33 PubPackageBuilder.buildPackageGraph (package:dartdoc/src/model/package_builder.dart:75:5)
<asynchronous suspension>
#34 Dartdoc.generateDocsBase (package:dartdoc/dartdoc.dart:185:24)
<asynchronous suspension>
#35 Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:233:24)
<asynchronous suspension>
#36 Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/dartdoc.dart:493:9)
<asynchronous suspension>
Not sure if this is a bug or if I did something wrong.
I'm seeing this too on the bleeding edge SDK (commit b41922f9253a59ed693d238f2d1332684b5873a6) when running dartdoc on dart_style.
I'm a dart rookie but this seems related? https://github.com/dart-lang/dartdoc/commit/b3927dd89d6ff9c78dc88ab2901e63b6a3bf29b7
If the fix is already in, should releasing a new path version fix the issue?
I am also having this issue.
Same issue for me. The base dartdoc package does not have this issue
Link to my package github actions output. This started to happen with the latest update.
Same problem here
Dart version: 2.16.0
I am getting error as well!
Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f105a6ca7 (6 days ago) • 2022-02-01 14:15:42 -0800
Engine • revision 776efd2034
Tools • Dart 2.16.0 • DevTools 2.9.2
Fixed in https://github.com/dart-lang/dartdoc/commit/b3927dd89d6ff9c78dc88ab2901e63b6a3bf29b7. Might be able to cherry-pick into a 2.16 minor release.
~~I'm not sure if dart sdk 2.16.1 is supposed to fix this issue but I'm facing the same thing on 2.16.1.~~
I see. It's not supposed to fix it. Hope it get cherry-picked into 2.16.2 or something.
No I didn't make that cherry-pick.
It looks like the only workaround is to downgrade to dart 2.15, correct?
Is there a suggested workaround for those using flutter? Downgrading to flutter 2.8.1 and then generating docs works, but it is not a great solution to have to keep switching versions. I supposed I could install dart 2.15 separately from flutter, but that also doesn't seem like a great solution.
Does this impact ability to generate documentation after publishing to pub, or is this issue only local?
Sorry, I meant to post the other workaround. Instead of running dart doc
, you can use the dartdoc package:
Run pub global activate dartdoc
to install the latest version of dartdoc compatible with your SDK. Then run pub run dartdoc
(I think).
Sorry, I meant to post the other workaround. Instead of running
dart doc
, you can use the dartdoc package:Run
pub global activate dartdoc
to install the latest version of dartdoc compatible with your SDK. Then runpub run dartdoc
(I think).
I hit the same issue when I do that. Instead of pub run dartdoc
I just ran dartdoc
. Let me know if that isn't what you meant. pub run dartdoc
gives me "Could not find package "dartdoc". Did you forget to add a dependency?"
Sorry, I think pub global run dartdoc
is the right command after activating it globally.
Sorry, I think
pub global run dartdoc
is the right command after activating it globally.
That works. Thank you.
for flutter users:
flutter pub global activate dartdoc
flutter pub global run dartdoc .
I'm hitting this issue as well
$ dart --version
Dart SDK version: 2.16.2 (stable) (Unknown timestamp) on "linux_x64"
try to add the package in your pubspec.yaml file if you faced any packages incompatible with dependency constraints, it will be (maybe) flutter-test comment it, in flutter version: 2.10.4 dart version: 2.16.2,
run:
flutter pub global activate dartdoc
make sure that the version of the plugin is 5.0.1, not 4.0.0, the error was thrown to me because of the incompatible dependency , and activated the
4.0.0 version
not5.0.1 version
then run:
flutter pub global run dartdoc .
I hope this solves your issue Happy coding mates