mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:07:49 +00:00
Add documentation of inference error cases.
In the course of implementing "why not promoted" support, I am having trouble following the various error cases in type_inferrer.dart and when they're triggered, so I decided to start adding short comments illustrating how they each one arises. I'll add more comments as the implementation gets further along and I cover more error cases. Change-Id: Icde498a4b884e1725cf98f8b9312879a696916bf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185841 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
parent
dcf6b12270
commit
229f59e669
|
@ -2788,6 +2788,13 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
fileOffset,
|
||||
noLength);
|
||||
} else {
|
||||
// Handles cases like:
|
||||
// int? i;
|
||||
// i.methodOnNonNullInt();
|
||||
// where `methodOnNonNullInt` is declared in an extension:
|
||||
// extension on int {
|
||||
// void methodOnNonNullInt() {}
|
||||
// }
|
||||
replacement = helper.wrapInProblem(
|
||||
replacement,
|
||||
templateNullableMethodCallError.withArguments(
|
||||
|
@ -2866,6 +2873,9 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
fileOffset,
|
||||
noLength);
|
||||
} else {
|
||||
// Handles cases like:
|
||||
// void Function()? f;
|
||||
// f.call();
|
||||
replacement = helper.wrapInProblem(
|
||||
replacement,
|
||||
templateNullableMethodCallError.withArguments(
|
||||
|
@ -3029,6 +3039,9 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
fileOffset,
|
||||
noLength);
|
||||
} else {
|
||||
// Handles cases like:
|
||||
// int? i;
|
||||
// i.abs();
|
||||
replacement = helper.wrapInProblem(
|
||||
replacement,
|
||||
templateNullableMethodCallError.withArguments(
|
||||
|
|
Loading…
Reference in a new issue