Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 02, 2017 [Issue 13767] Template type inference fails when destructuring shared type | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13767 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |dlang-bugzilla@thecybershad | |ow.net Resolution|--- |INVALID --- Comment #1 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- No, because you use ==, which does exact matching. If you want to partially match the type (i.e. check if it's implicitly convertible to shared), use `:`, not `==`: shared const int i; static if (is(typeof(i) == shared U, U)) { pragma(msg, U); // now prints const(int) } void main() { } -- |
July 02, 2017 [Issue 13767] Template type inference fails when destructuring shared type | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13767 --- Comment #2 from monkeyworks12@hotmail.com --- I'm assuming in your example you meant to use : instead of ==. That aside, why shouldn't this work? I'm trying to destructure some type which matches the pattern `shared U`. `shared const(int)` *should* match that pattern. What I'm trying to express is `∃ U: shared U == shared const int`; it seems incorrect to me that that I should have to use the subtyping form of is. -- |
July 02, 2017 [Issue 13767] Cannot partially destructure type qualifiers with == form of IsExpression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13767 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |spec Status|RESOLVED |REOPENED Resolution|INVALID |--- Summary|Template type inference |Cannot partially |fails when destructuring |destructure type qualifiers |shared type |with == form of | |IsExpression --- Comment #3 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- (In reply to monkeyworks12 from comment #2) > I'm assuming in your example you meant to use : instead of ==. Oops, yes. > That aside, why shouldn't this work? I'm trying to destructure some type which matches the pattern `shared U`. `shared const(int)` *should* match that pattern. What I'm trying to express is `∃ U: shared U == shared const int`; it seems incorrect to me that that I should have to use the subtyping form of is. OK, I see what you mean now. It looks like partial destructuring of type qualifiers was never implemented for == variants of IsExpression. It is the same for inout: static assert(!is(shared const int == shared U, U)); // should work static assert( is(shared const int : shared U, U)); static assert(!is(inout const int == const U, U)); // should work static assert( is(inout const int : const U, U)); -- |
December 17, 2022 [Issue 13767] Cannot partially destructure type qualifiers with == form of IsExpression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13767 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 13767] Cannot partially destructure type qualifiers with == form of IsExpression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13767 --- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18917 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation