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

bad generics substitution in analyzer package with type.substitute4 #19253

Closed
DartBot opened this issue Jun 5, 2014 · 12 comments
Closed

bad generics substitution in analyzer package with type.substitute4 #19253

DartBot opened this issue Jun 5, 2014 · 12 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. closed-not-planned Closed as we don't intend to take action on the reported issue
Milestone

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2014

This issue was originally filed by @a14n


In analyzer-0.13.5 (and also in 0.15.5) calling r = type.substitute4(argumentsTypes) doesn't return the expected DartType for :

  type=Iterable<Iterable<E>>
  argumentsTypes=[Iterable<String>]
  r=Iterable<Iterable<E>>

For this case r should be Iterable&lt;Iterable&lt;String&gt;&gt;.

However it works with simplier parameters :

  type=Iterable<E>
  argumentsTypes=[String]
  r=Iterable<String>

@iposva-google
Copy link
Contributor

Added Area-Analyzer, Triaged labels.

@bwilkerson
Copy link
Member

Added this to the 1.6 milestone.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@bwilkerson
Copy link
Member

Set owner to collinsn@google.com.

@kasperl
Copy link

kasperl commented Jul 10, 2014

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

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@DartBot
Copy link
Author

DartBot commented Sep 26, 2014

This comment was originally written by collinsn@google.com


My internship is ending today.


Set owner to @bwilkerson.

@bwilkerson
Copy link
Member

Added Started label.

@bwilkerson
Copy link
Member

I know how to change the behavior of the method, but doing so would incur a performance penalty. Given that it's been 5 months since the issue was filed (sorry about that!), I'm guessing that the fix is no longer needed. I have therefore updated the doc comment for the method to indicate the state of the implementation. Please reopen the issue if the current implementation is still causing you problems.

@DartBot
Copy link
Author

DartBot commented Nov 5, 2014

This comment was originally written by @a14n


I took some times to remember where I wanted to use it :) But finally I found it in zengen. Here is the workaround I have used.

      // final newType = type.substitute4(argumentsTypes);
      final newType = new InterfaceTypeImpl.con1(type.element);
      newType.typeArguments = argumentsTypes;
      return newType;

What do you think ?

@bwilkerson
Copy link
Member

Given that what you want is to completely replace the list of arguments, I think that's a fine solution. Another possibility, which isn't necessarily any better would be:
  return type.element.type.substitute4(argumentsTypes);


Added NotPlanned label.

@DartBot
Copy link
Author

DartBot commented Nov 5, 2014

This comment was originally written by @a14n


Thanks for your advices.

@clayberg
Copy link

Added this to the 1.8 milestone.

@DartBot DartBot added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. closed-not-planned Closed as we don't intend to take action on the reported issue labels Nov 28, 2014
@DartBot DartBot added this to the 1.8 milestone Nov 28, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

5 participants