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

dartdoc failed: type 'PropertyAccessImpl' is not a subtype of type 'IdentifierImpl' in type cast #2934

Closed
lunacd opened this issue Feb 4, 2022 · 18 comments
Labels
P2 A bug or feature request we're likely to work on P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@lunacd
Copy link

lunacd commented Feb 4, 2022

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.

@munificent
Copy link
Member

I'm seeing this too on the bleeding edge SDK (commit b41922f9253a59ed693d238f2d1332684b5873a6) when running dartdoc on dart_style.

@lunacd
Copy link
Author

lunacd commented Feb 4, 2022

I'm a dart rookie but this seems related?
b3927dd

If the fix is already in, should releasing a new path version fix the issue?

@joranmulderij
Copy link

I am also having this issue.

@ivoleitao
Copy link

Same issue for me. The base dartdoc package does not have this issue

@ivoleitao
Copy link

Link to my package github actions output. This started to happen with the latest update.

@RicardoRB
Copy link

Same problem here

Dart version: 2.16.0

@dw2kim
Copy link

dw2kim commented Feb 7, 2022

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

@srawlins
Copy link
Member

srawlins commented Feb 8, 2022

Fixed in b3927dd. Might be able to cherry-pick into a 2.16 minor release.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Feb 8, 2022
This includes a fix for dart-lang/dartdoc#2934

google3 has been running with this commit for over a week.

Change-Id: Ice86344f9fcf6503ad0c4d71fddd71bd292ca1bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232088
Reviewed-by: Brian Wilkerson <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Samuel Rawlins <[email protected]>
@lunacd
Copy link
Author

lunacd commented Feb 10, 2022

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.

@srawlins
Copy link
Member

No I didn't make that cherry-pick.

@Jordan-Nelson
Copy link

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?

@srawlins
Copy link
Member

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).

@Jordan-Nelson
Copy link

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).

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?"

@srawlins
Copy link
Member

Sorry, I think pub global run dartdoc is the right command after activating it globally.

@Jordan-Nelson
Copy link

Sorry, I think pub global run dartdoc is the right command after activating it globally.

That works. Thank you.

@doradsoft
Copy link

for flutter users:

flutter pub global activate dartdoc
flutter pub global run dartdoc .

@mkorbel1
Copy link

mkorbel1 commented Apr 5, 2022

I'm hitting this issue as well

$ dart --version
Dart SDK version: 2.16.2 (stable) (Unknown timestamp) on "linux_x64"

@Mo0Khaled
Copy link

Mo0Khaled commented Apr 9, 2022

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 not 5.0.1 version

then run:

flutter pub global run dartdoc .

I hope this solves your issue
Happy coding mates

ivoleitao added a commit to ivoleitao/stash that referenced this issue Apr 17, 2022
@srawlins srawlins added P2 A bug or feature request we're likely to work on P3 A lower priority bug or feature request labels Jun 29, 2022
@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 A bug or feature request we're likely to work on P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests