Skip to content

The type '((dynamic) → dynamic) → Iterable<dynamic>' is declared with 0 type parameters, but 0 type arguments were given #25641

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

Closed
alan-knight opened this issue Feb 2, 2016 · 11 comments
Assignees
Labels
legacy-area-analyzer Use area-devexp instead. 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

@alan-knight
Copy link
Contributor

From Intl: test/date_time_format_test_core.dart:369

The code below, which was previously passing, now gives warnings.

 Map<int, DateTime> generateDates(int year, int leapDay) =>
      new Iterable.generate(365 + leapDay, (n) => n + 1)
          .map /*<DateTime>*/ ((day) {
        var result = new DateTime(year, 1, day);
        // TODO(alanknight): This is a workaround for dartbug.com/15560.
        if (result.toUtc() == result) result = new DateTime(year, 1, day);
        return result;
      }).toList().asMap();

WARNING: The type '((dynamic) → dynamic) → Iterable' is declared with 0 type parameters, but 0 type arguments were given ([intl] test/date_time_format_test_core.dart:369)

and also

WARNING: new Iterable.generate(365 + leapDay, (n) => n + 1).map((day) {var result = new DateTime(year, 1, day); if (result.toUtc() == result) result = new DateTime(year, 1, day); return result;}).toList().asMap() (Map<int, dynamic>) will need runtime check to cast to type Map<int, DateTime>

The second is more reasonable, although I'd have thought it could be inferred.

@bwilkerson bwilkerson added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures legacy-area-analyzer Use area-devexp instead. labels Feb 2, 2016
@jmesserly
Copy link

@alan-knight is this in the command line analyzer or IDE?

I've seen this too, and the command line analyzer side was recently fixed. What's going on is we're analyzing against the SDK without strong mode turned on, which means no generic methods.

@jmesserly
Copy link

Another guess, we don't do upward inference on constructors -- so new Iterable.generate won't infer. That is covered by #25220.

@jmesserly jmesserly removed their assignment Feb 2, 2016
@alan-knight
Copy link
Contributor Author

This is in Intellij, using, I think, 1.14.0_dev_7_2. It might be that it doesn't have that flag turned on for the SDK, not sure how to tell.

@bwilkerson
Copy link
Member

If this in in IntelliJ, then you're running server and we're not setting this flag appropriately.

@jmesserly What would the effect be of setting strong-mode in the SDK context if it isn't set in the user's context? (I'm just wondering if, until we get it fixed, we can make life better for folks by reversing the default.)

@vsmenon
Copy link
Member

vsmenon commented Feb 2, 2016

@bwilkerson That may have unintended consequences? I don't think we have any testing of non-strong user code and against strong SDK. In theory, inferred elements in the SDK could change errors and warnings in non-strong user code.

How hard would a real fix be?

@bwilkerson
Copy link
Member

In theory, inferred elements in the SDK could change errors and warnings in non-strong user code.

Good point.

How hard would a real fix be?

I working on it now, I just need to carve out enough time. I'm hoping to have it done by the end of the week unless other issues take priority.

@vsmenon
Copy link
Member

vsmenon commented Feb 3, 2016

General bug filed:
#25667

@jmesserly
Copy link

General bug is fixed. I'll double check where this is at now. Regardless we need to fix the "0 type args 0 type params" message

@jmesserly jmesserly added Priority-Medium and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Feb 10, 2016
@jmesserly
Copy link

Confirmed Alan's bug is fixed. Here's a new repro:

f() {}
main() {
  // [warning] The type '() → dynamic' is declared with 0 type parameters, but 0 type arguments were given
  f/*<int>*/();
}

@jmesserly jmesserly self-assigned this Feb 10, 2016
@jmesserly
Copy link

Found it. It's a silly bug :)

@jmesserly
Copy link

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. 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

5 participants