[SR-6272] Tailored diagnostics with fixits for numerical conversions #48822
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
good first issue
Good for newcomers
Additional Detail from JIRA
md5: 5bec69d6c4f8dae3c2d65ea11480dead
Issue Description:
Conversions among numerical types, and things that are readily convertible to numbers such as enums, are frequently necessary, and we don’t give great feedback when conversions are missing or incorrect, leading to road rage:
https://twitter.com/gumbright/status/626190317025267713
It would be worthwhile to give the type checker special knowledge of the converting initializers and properties available in the standard library for the numeric types, and when a type mismatch is encountered, try to find a set of conversions that can make the system type-check, for things like mismatched integer types, float precision, int-to-float mixups, or enum-to-raw-value conversions.
The text was updated successfully, but these errors were encountered: