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

Argument type mismatch hint is incomplete #20497

Closed
bwilkerson opened this issue Aug 13, 2014 · 3 comments
Closed

Argument type mismatch hint is incomplete #20497

bwilkerson opened this issue Aug 13, 2014 · 3 comments
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@bwilkerson
Copy link
Member

Given the following code:

class F {
  void call(int x, String y) {
  }
}

main() {
  var function = null as F;
  function('', [2]);
  function.call('', [2]);
}

Analyzer will hint (HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE) on the line with ".call(" that the argument types do not correspond to the parameter types, but will not hint on the line above. It should hint on both lines.

@bwilkerson
Copy link
Member Author

Here's another symptom of the same issue:

I have this class (impl. of Haskell's Just)
 
class Just<A> implements Function
{
    A val;
    
    Just (this.val);
    Just<dynamic> call(dynamic fun (A o)) => new Just<dynamic> (fun (val));
    
    Just<dynamic> fmap (dynamic fun (A o)) => new Just<dynamic> (fun (val));
}
 
and was experimenting doing something like

main ()
{
    int add1 (int n) => n + 1;

    Just<int> Initial = new Just<int> (3);
    var withFMap = Initial .fmap (add1) .fmap (add1);
    var withCall = Initial (add1) (add1);

    print (withFMap.val); //5
    print (withCall.val); //5
}
 
While both produce the same result, the Editor correctly notices that "withFMap" is of type "Just" and helps me auto-complete the "val" field, but I get no feedback on "withCall" object that is produced using the "call ()" method and it just gets inferred as Dynamic.

@bwilkerson bwilkerson added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-warning Issues with the analyzer's Warning codes labels Nov 28, 2014
@bwilkerson bwilkerson removed the Triaged label Nov 4, 2015
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Priority-Medium labels Mar 1, 2016
@parlough
Copy link
Member

This has been fixed somewhere along the line:

Screen Shot 2019-05-16 at 17 09 09

Screen Shot 2019-05-16 at 17 09 54

@srawlins
Copy link
Member

Hooray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants