-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
affects ABIFlag: Affects ABIFlag: Affects ABIcompilerThe Swift compiler itselfThe Swift compiler itselfimprovementstandard libraryArea: Standard library umbrellaArea: Standard library umbrella
Description
Previous ID | SR-8170 |
Radar | None |
Original Reporter | @beccadax |
Type | Improvement |
Status | Closed |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler, Standard Library |
Labels | Improvement, AffectsABI |
Assignee | @beccadax |
Priority | Medium |
md5: 2dd2dc20cece34d956473f7aaa2869ac
Issue Description:
When we trap due to a failed force-unwrap, there are two possible causes: either the user wrote a force-unwrap explicitly, or the compiler inserted a force-unwrap for an implicitly unwrapped optional. Explicit force-unwraps are common and easy to notice; IUOs are more rare but much harder to debug (since the places you might unwrap are invisible).
We should trap with a different error messages for explicit and implicit unwraps. This would help users decide whether they should examine the visible `!` characters in their code or audit it for IUOs they didn't account for.
This may affect ABI if we implement it by adding a parameter to the _diagnoseUnexpectedNilOptional function.
Metadata
Metadata
Assignees
Labels
affects ABIFlag: Affects ABIFlag: Affects ABIcompilerThe Swift compiler itselfThe Swift compiler itselfimprovementstandard libraryArea: Standard library umbrellaArea: Standard library umbrella