You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This seems a lot like dart-lang/sdk#60188, but interestingly enough this class has generics. Does it also reproduce for classes without type parameters?
It seems to be related to type aliases. There's a lot of typedefs like:
typedef StaticOptions = Either2<bool, String>;
And we seem to walk type aliases suggest the target constructors (presumably without anything checking they haven't already been added). I'm not sure why we do this if we're going to use the target name though (it would make more sense if they showed up as StaticOptions.t1.
Ideally these typedefs wouldn't even be public, but I think they're needed because they're used in public signatures.
Edit: Smaller repro:
classFoooooooo {
Foooooooo.x();
}
typedefBar1=Foooooooo;
typedefBar2=Foooooooo;
typedefBar3=Foooooooo;
var id =Foo^
Oh, I definetly remember seing something around type alias when fixing dart-lang/sdk#61244. So the fix would probably be around that area too if you want to remove those. But I'd actually prefer (as you suggested) we use the type alias name for the completion items. Since sometimes the alias is the only way to access the type (for whatever reason someone might do that).
//c.dartclass_C {}
typedefClass=_C;
voidf(Class c) {}
//other.dartimport'c.dart';
voidmain() =>f(Cla^);
Activity
FMorschel commentedon Mar 26, 2026
This seems a lot like dart-lang/sdk#60188, but interestingly enough this class has generics. Does it also reproduce for classes without type parameters?
DanTup commentedon Mar 31, 2026
It seems to be related to type aliases. There's a lot of typedefs like:
And we seem to walk type aliases suggest the target constructors (presumably without anything checking they haven't already been added). I'm not sure why we do this if we're going to use the target name though (it would make more sense if they showed up as
StaticOptions.t1.Ideally these typedefs wouldn't even be public, but I think they're needed because they're used in public signatures.
Edit: Smaller repro:
FMorschel commentedon Mar 31, 2026
Oh, I definetly remember seing something around type alias when fixing dart-lang/sdk#61244. So the fix would probably be around that area too if you want to remove those. But I'd actually prefer (as you suggested) we use the type alias name for the completion items. Since sometimes the alias is the only way to access the type (for whatever reason someone might do that).
DanTup commentedon Mar 31, 2026
I've opened https://dart-review.googlesource.com/c/sdk/+/491880
[analysis_server] Fix type name for constructors from type aliases in…
DanTup commentedon Apr 6, 2026
Fixed by dart-lang/sdk@931a3ff, ships in the SDK.