| Thread overview | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 12, 2022 [Issue 23105] `__trait(getMember)` and `mixin()` of the same code as a string behaves differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 --- Comment #1 from Basile-z <b2.temp@gmx.com> --- note: the module is the automatic import of object.d so this test case cant be tested with -betterC. -- | ||||
May 12, 2022 [Issue 23105] `__trait(getMember)` and `mixin()` of the same code as a string behave differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|`__trait(getMember)` and |`__trait(getMember)` and |`mixin()` of the same code |`mixin()` of the same code |as a string behaves |as a string behave |differently |differently -- | ||||
May 12, 2022 [Issue 23105] `__trait(getMember)` and `mixin()` of the same code as a string behave differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 --- Comment #2 from Basile-z <b2.temp@gmx.com> --- somewhat better. Static evaluation is known to have problems with shortcut && and ||: ``` module self; enum getMember = `__traits(getMember, sym, m)`; template test(alias sym) { static foreach (m; __traits(allMembers, sym)) { static if (m == "object") static if (is(__traits(getMember, sym, "object")==module)) static assert(0); // pass static if (m == "object") static if (is(mixin(getMember)==module)) static assert(0, m); // fails } } void main() { alias _ = test!(self); } ``` -- | ||||
May 13, 2022 [Issue 23105] `__trait(getMember)` and `mixin()` of the same code as a string behave differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> --- @BorisCarvajal created dlang/dmd pull request #14119 "Fix Issue 23105 - `__trait(getMember)` and `mixin()` of the same code as a string behave differently" fixing this issue: - Fix Issue 23105 - `__trait(getMember)` and `mixin()` of the same code as a string behave differently The fix is to remove the `SCOPE.alias_` dependency when resolving TypeTraits on certain conditions, it's not necessary, the trait resolves to type or symbol naturally. Changes: - Remove `SCOPE.alias_` as it is no longer used. - Remove a huge `if` with an early error from `TypeTraits` typeSemantic. - Cache not only symbols but also types in TypeTraits (TypeTraits.sym -> TypeTraits.obj). - Move `TypeTraits.typeSemantic` logic to `TypeTraits.resolve` since `typeSemantic` should only care about giving a type and `resolve` about maybe something else (like TypeMixin logic). https://github.com/dlang/dmd/pull/14119 -- | ||||
May 13, 2022 [Issue 23105] `__trait(getMember)` and `mixin()` of the same code as a string behave differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #14119 "Fix Issue 23105 - `__trait(getMember)` and `mixin()` of the same code as a string behave differently" was merged into master: - acee742790929cf7fb3ea9817254708baa06f3e1 by Boris Carvajal: Fix Issue 23105 - `__trait(getMember)` and `mixin()` of the same code as a string behave differently The fix is to remove the `SCOPE.alias_` dependency when resolving TypeTraits on certain conditions, it's not necessary, the trait resolves to type or symbol naturally. Changes: - Remove `SCOPE.alias_` as it is no longer used. - Remove a huge `if` with an early error from `TypeTraits` typeSemantic. - Cache not only symbols but also types in TypeTraits (TypeTraits.sym -> TypeTraits.obj). - Move `TypeTraits.typeSemantic` logic to `TypeTraits.resolve` since `typeSemantic` should only care about giving a type and `resolve` about maybe something else (like TypeMixin logic). https://github.com/dlang/dmd/pull/14119 -- | ||||
May 13, 2022 [Issue 23105] `__trait(getMember)` and `mixin()` of the same code as a string behave differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 --- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #14120 "Tiny follow up for pull #14119 (Issue 23105)" was merged into master: - 79d9c5b9114474ab8690f75b25a3dbbd0e7d3b9c by Boris Carvajal: Tiny follow up for pull #14119 (Issue 23105) Cache TypeTraits semantic on error too. https://github.com/dlang/dmd/pull/14120 -- | ||||
June 25, 2022 [Issue 23105] `__trait(getMember)` and `mixin()` of the same code as a string behave differently | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23105 Boris Carvajal <boris2.9@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxsamukha@gmail.com --- Comment #6 from Boris Carvajal <boris2.9@gmail.com> --- *** Issue 23211 has been marked as a duplicate of this issue. *** -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply