Bug 21949 – noreturn doesn't follow covariance rules

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-05-21T18:42:58Z
Last change time
2021-06-21T20:51:11Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel

Comments

Comment #0 by moonlightsentinel — 2021-05-21T18:42:58Z
The DIP[1] states that the bottom type must satisfy the following conditions: is(noreturn[] : T[]) is(noreturn* : T*) is(noreturn function(S) : T function(S), S...) is(noreturn delegate(S) : T delegate(S), S...) None of these work ATM. [1] https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1034.md
Comment #1 by dlang-bot — 2021-05-21T19:12:23Z
@MoonlightSentinel updated dlang/dmd pull request #12559 "Fix 21949 - Implement conversion/covariance rules for TypeNoreturn" fixing this issue: - Fix 21949 - Implement conversion/covariance rules for TypeNoreturn Ensure that `TypeNoreturn.implicitConv` and `TypeNoreturn.constConv` always return `Match.convert` for other types because the bottom type is convertible to any type. Also make `covariant` accept `TypeNoreturn` as a substitute for any other type because the return value will never actually be returned. This behaviour is explicitly specified by DIP 1034. https://github.com/dlang/dmd/pull/12559
Comment #2 by moonlightsentinel — 2021-06-21T20:51:11Z
PR was merged