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

Incomplete code completion from static collection #11062

Closed
sethladd opened this issue Jun 4, 2013 · 12 comments
Closed

Incomplete code completion from static collection #11062

sethladd opened this issue Jun 4, 2013 · 12 comments
Assignees
Labels
area-analyzer P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@sethladd
Copy link
Contributor

sethladd commented Jun 4, 2013

Consider this code:

class Foo {
  static List strings = new List<String>();
}

void main() {
  Foo.strings.first.[CODE COMPLETE]
}

expected:

options for a string

actual:

options from Object

Please see attached screenshot.

Hope this helps!


Attachment:
[Screen Shot 2013-06-03 at 9.42.08 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-11062/comment-0/Screen Shot 2013-06-03 at 9.42.08 PM.png) (72.57 KB)

@sethladd
Copy link
Contributor Author

sethladd commented Jun 4, 2013

Note, if I change the list to:

  static List<String> strings = new List<String>();

I see the expected code completion options.

@clayberg
Copy link

clayberg commented Jun 4, 2013

Set owner to @stevemessick.
Added this to the M6 milestone.

@stevemessick
Copy link
Contributor

It appears type propagation is ignoring generics.


Set owner to @bwilkerson.

@bwilkerson
Copy link
Member

Removed Area-Editor label.
Added Area-Analyzer label.

@bwilkerson
Copy link
Member

Removed this from the M6 milestone.
Added this to the M7 milestone.

@jwren
Copy link
Member

jwren commented Sep 19, 2013

M7 -> M8


Removed this from the M7 milestone.
Added this to the M8 milestone.

@bwilkerson
Copy link
Member

Removed this from the M8 milestone.
Added this to the Later milestone.
Removed Type-Defect label.
Added Type-Enhancement label.

@DartBot
Copy link

DartBot commented Apr 5, 2014

This comment was originally written by @chalin


Isn't there concern that strings might have its value changed? To me the fact that completion make use of the declared type of strings makes sense. If strings were a local variable then doing intra-procedural analysis is tractable (and so you could assume that strings was still assigned a List<String> value), but having inter-procedural analysis conclude that the Foo.strings field is still a List<String> in main seems risky to me (in the general case).

@bwilkerson
Copy link
Member

Isn't there concern that strings might have its value changed?

Yes. And it's possible that we won't do anything about this issue for that very reason. But if it we could record that 'String' is a "high probability" value for the element type then we could potentially order the code completion results with the ones for String closer to the beginning. I suspect that this would place the desired completions near the top more frequently.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Feb 29, 2016
@bwilkerson
Copy link
Member

Closing as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

8 participants