You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just noticed that ClassInfo.find doesn't work for nested classes, even if they are static. For example:
unittest
{
static class Foo { }
auto name = Foo.classinfo.name;
assert(ClassInfo.find(name) is null); // unfortunately passes
}
I was about to try the documented unit test feature in my work on std.serialization but I want to have the type I'm serializing visible in the example as well.
Is it possible to fix somehow? I looked at the symbol table and it seems the class info is there, but ClassInfo.find just can't find it.
0000000100040980 D _D4test14__unittestL7_1FZv3Foo6__initZ
0000000100040a50 D _D4test14__unittestL7_1FZv3Foo6__vtblZ
00000001000409b0 D _D4test14__unittestL7_1FZv3Foo7__ClassZ
The text was updated successfully, but these errors were encountered:
I'm pretty sure that class infos for nested classes are never added by the compiler in the first place, see this:
https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L68-L73
The compiler needs to iterate all types that can have nested classes, not just the members of the module, as it does now. I tried to fix this myself but I haven't been able to figure out how to iterate all nested types of a function.
I'm setting this back to an issue with the compiler.
Jacob Carlborg (@jacob-carlborg) reported this on 2013-08-19T08:11:38Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=10853
CC List
Description
I just noticed that ClassInfo.find doesn't work for nested classes, even if they are static. For example: unittest { static class Foo { } auto name = Foo.classinfo.name; assert(ClassInfo.find(name) is null); // unfortunately passes } I was about to try the documented unit test feature in my work on std.serialization but I want to have the type I'm serializing visible in the example as well. Is it possible to fix somehow? I looked at the symbol table and it seems the class info is there, but ClassInfo.find just can't find it. 0000000100040980 D _D4test14__unittestL7_1FZv3Foo6__initZ 0000000100040a50 D _D4test14__unittestL7_1FZv3Foo6__vtblZ 00000001000409b0 D _D4test14__unittestL7_1FZv3Foo7__ClassZThe text was updated successfully, but these errors were encountered: