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

Insert explicit type arguments where types could not be inferred. #1813

Merged
merged 1 commit into from Oct 24, 2022

Conversation

srawlins
Copy link
Contributor

This change is a no-op.

The Dart compiler front-end (“CFE”) and static analyzer (“analyzer”) intend to fix a bug in which “could not infer” errors are not reported for top-level elements. (The same error is already reported in local elements.) Typically in such code, the developer has incorrectly expected inference to flow a certain way and infer a type which satisfies a bound, and the CFE and analyzer don’t report any error, so they submit their code. Here is a minified example:

class C<P extends num> {
  factory C(Iterable<P> p) => C._();
  C._();
}

var c = C([]);

A developer expects (reasonably) that inference would land on C<num> and List<num> for the types of c and the List literal. However, details in the inference algorithms actually mean that inference cannot determine the implicit type of C, which needs to be a compile-time error.

@jathak jathak merged commit 6e670ef into sass:main Oct 24, 2022
@srawlins srawlins deleted the type-args branch October 24, 2022 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[breaking change] Report type inference errors in top-level fields
2 participants