Bug 22383 – Array of bottom types not recognized as a range

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2021-10-13T14:52:57Z
Last change time
2021-10-14T17:23:23Z
Keywords
pull
Assigned to
No Owner
Creator
Ate Eskola

Comments

Comment #0 by Ajieskola — 2021-10-13T14:52:57Z
--------------- void main () { import std; isInputRange!(noreturn[]).writeln; } --------------- Should output `true` but outputs `false`
Comment #1 by moonlightsentinel — 2021-10-13T16:58:42Z
The underlying issue is that isAutodecodableString(noreturn[]) is currently true. This causes the referenced front and popFront to call the string decoding routines which reject noreturn[].
Comment #2 by dlang-bot — 2021-10-14T13:03:08Z
@MoonlightSentinel created dlang/phobos pull request #8275 "Fix 22383 - Reject noreturn[] as an autodecodable string" fixing this issue: - Fix 22383 - Reject noreturn[] as an autodecodable string `noreturn[]` does not contain characters and hence is not subject to autodecoding. The previous behaviour caused the range primitives (`put`, ...) to call into autodecoding related functions which couldn't handle `noreturn[]`. That error caused `isInputRange!(noreturn[])` to yield false. https://github.com/dlang/phobos/pull/8275
Comment #3 by dlang-bot — 2021-10-14T17:23:23Z
dlang/phobos pull request #8275 "Fix 22383 - Reject noreturn[] as an autodecodable string" was merged into master: - d90fc903d928a769ce72f0269fecc7e4d7ef8bba by MoonlightSentinel: Fix 22383 - Reject noreturn[] as an autodecodable string `noreturn[]` does not contain characters and hence is not subject to autodecoding. The previous behaviour caused the range primitives (`put`, ...) to call into autodecoding related functions which couldn't handle `noreturn[]`. That error caused `isInputRange!(noreturn[])` to yield false. https://github.com/dlang/phobos/pull/8275