Description
(Parent issue #44897)
We are currently in the process of adding functionality to the CFE and analyzer to explain type promotion failures to the user. For example in the following code:
class C {
int? i; // (1)
f() {
if (i == null) return;
i.isEven; // (2)
}
}
the error message generated at (2) will contain a context message (pointing to (1)) explaining that i
couldn't be promoted because it's a field.
We'll have other context messages for other non-promotion reasons (e.g. the variable has been written to since it was promoted, the variable is write captured, etc.)
It would be nice if these context messages could contain links to documentation pages explaining the reasons for the type promotion failures in more detail. This is particularly important for field non-promotion, since it's a common user trap.
Note that this bug covers both writing the documentation and linking it up to the context messages.