Bug 23730 – Clarify IsExpression `Identifier :` and `== TypeCtor` spec

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-02-21T18:16:47Z
Last change time
2023-02-27T09:02:22Z
Keywords
pull
Assigned to
No Owner
Creator
Nick Treleaven

Comments

Comment #0 by nick — 2023-02-21T18:16:47Z
https://dlang.org/spec/expression.html#is-identifier-convert > TypeSpecialization is only allowed to be a Type A type pattern involving Identifier is not literally a type, so this sentence should not apply to the pattern case. > if TypeSpecialization is dependent on Identifier, the TypeSpecialization forms a pattern from which the type of Identifier is deduced. This doesn't mention that the pattern can match a type that implicitly converts from Type. It should also state the condition doesn't match if the pattern doesn't match. --- https://dlang.org/spec/expression.html#is-type-equal > the condition is satisfied if Type is one of those. The `== TypeCtor` forms should use more precise language about a top-level type constructor, as `is(const(int)[] == const)` is false. That should be in an example as well as examples of it being true. --- PR incoming.
Comment #1 by dlang-bot — 2023-02-21T18:19:24Z
@ntrel updated dlang/dlang.org pull request #3534 "[spec] Improve `is(Type == keyword)` docs" fixing this issue: - Split up type vs pattern forms & add examples Add example of type implicitly converting to match pattern. Update `Identifier ==` example and add pattern example. Fixes Issue 23730 - Clarify IsExpression `Identifier :` and `== TypeCtor` spec. https://github.com/dlang/dlang.org/pull/3534
Comment #2 by dlang-bot — 2023-02-27T09:02:22Z
dlang/dlang.org pull request #3534 "[spec] Improve `is(Type == keyword)` and Identifier docs" was merged into master: - 759d5424087dea558944e5e2b7ed78804df5c5c1 by Nick Treleaven: Split up type vs pattern forms & add examples Add example of type implicitly converting to match pattern. Update `Identifier ==` example and add pattern example. Fixes Issue 23730 - Clarify IsExpression `Identifier :` and `== TypeCtor` spec. https://github.com/dlang/dlang.org/pull/3534