Skip to content

aliasElement not populated on non-function typedef references #45291

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

Open
jcollins-g opened this issue Mar 11, 2021 · 7 comments
Open

aliasElement not populated on non-function typedef references #45291

jcollins-g opened this issue Mar 11, 2021 · 7 comments
Assignees
Labels
analyzer-api Issues that impact the public API of the analyzer package area-dart-model For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer. P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jcollins-g
Copy link
Contributor

@scheglov

Given the following code:

typedef T0 = void;
typedef T1 = Function;
typedef T2<X> = List<X>;
typedef T3<X, Y> = Map<X, Y>;
typedef T4 = void Function();

T0 a;

class C2 {
  T0 b;
  T1 c;
  T2 d(T3 e, T4 f);
}

DartTypes generated for a, b, c, d, and e do not appear to have populated fields for aliasElement/aliasArguments. Only f has these fields populated. I have gone over how dartdoc is finding these, and just looking at the most basic level of inspecting element.type I do not see the fields populated even with the experiment on. For example:

Screen Shot 2021-03-11 at 2 03 38 PM

Without this Dartdoc is unable to reconnect the types to their aliases, which leads to lower quality documentation.

@jcollins-g jcollins-g added legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on analyzer-api Issues that impact the public API of the analyzer package labels Mar 11, 2021
@scheglov scheglov self-assigned this Mar 12, 2021
@scheglov
Copy link
Contributor

So, we already support aliasElement and aliasArguments for FunctionType.

We can and will support InterfaceType and TypeParameterType.

We cannot currently support dynamic, Never, and void because these types are singletons in the analyzer. This will require much bigger changes.

@jcollins-g
Copy link
Contributor Author

Of these I think the dynamic / Never / void case is the least interesting. The others though would be helpful to have though not strictly necessary to ship with (hence P2)

@scheglov
Copy link
Contributor

InterfaceType support was added in https://dart-review.googlesource.com/c/sdk/+/190731
TypeParameterType support will be added in https://dart-review.googlesource.com/c/sdk/+/190734

@jcollins-g
Copy link
Contributor Author

Great! This probably falls to P3 once both of these land as the other cases aren't that useful to actual users IMO.

dart-bot pushed a commit that referenced this issue Mar 12, 2021
Bug: #45291
Change-Id: I97bab24f4d7cf3232a0260ec3c6abec6a4c310be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190731
Reviewed-by: Samuel Rawlins <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
@jcollins-g jcollins-g added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels Mar 12, 2021
dart-bot pushed a commit that referenced this issue Mar 12, 2021
…rType.

Bug: #45291
Change-Id: Ia0378722f0e7c48e7a3042c0ef14d6833c7bf2b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190734
Reviewed-by: Janice Collins <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
@scheglov
Copy link
Contributor

https://dart-review.googlesource.com/c/sdk/+/191303 to publish analyzer.

@kevmoo
Copy link
Member

kevmoo commented Feb 2, 2022

@scheglov – is this fixed?

@scheglov
Copy link
Contributor

scheglov commented Feb 2, 2022

Mostly, but not fully.
It is not fixed for dynamic, Never, and void.

@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 14, 2024
@johnniwinther johnniwinther added area-dart-model For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer. and removed legacy-area-analyzer Use area-devexp instead. labels Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-api Issues that impact the public API of the analyzer package area-dart-model For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer. 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

5 participants