View Issue Details

IDProjectCategoryView StatusLast Update
0000843LDMudLPC Compiler/Preprocessorpublic2019-08-29 23:39
Reporter_xtian_ Assigned ToGnomi  
Status resolvedResolutionfixed 
Summary0000843: struct runtime lookup regression
DescriptionWhen upgrading to a september 2015 version of 3.5 (from early 2014 version), I found a regression in the struct runtime lookup code.

the following used to compile (note the use of polymorphism for the struct argument):


struct a_t {
  mapping m; // compiles without this line

struct b_t (a_t) {
  int i;

void fun(struct a_t a, string s)
  a->(s)= 42;

void create()
  struct b_t b = (<b_t>);

  fun(b, "i");

  printf("%O\n", b);
TagsNo tags attached.
External Data (URL)


related to 0000049 closedGnomi LDMud 3.3 Computed struct name lookup should be smarter 



2015-09-01 22:55

manager   ~0002263

Oh, this is soo mean. I was so glad to have finally solved Lars' test case t-040413:

struct Door
    string flags;

struct Exit
    string flags;

struct Exits
    struct Exit up;
    struct Exit down;

struct Room
    struct Exits exit;

void main()
    struct Room room;
    string dir;

    // The in the following line the driver should be able to determine
    // that only a struct Exit could be the result of the computed lookup.


But given the example in the bug report that test scenario is not true, because room->exit could be some derived struct containing other entries that are not a struct Exit.

So, the solution would be to just undo f69c91bb464077b3465d8ae5793dd041591b6a95 and remove that test scenario.


2015-09-06 05:44

reporter   ~0002264

Concerning Lars' test case:

- If find it is ambig, because structs do implement polymorphism. It is a bad test case.
- with the usage of ->(dir) the programmer explicitly states that he wants runtime lookup, anyway, doesn't he? In that case compile-time lookup seems unexpected.

I would compare the case to C++ dynamic_cast. You wouldn't want the compiler to start guessing types based on some arbitrary scope.

Issue History

Date Modified Username Field Change
2015-09-01 22:33 _xtian_ New Issue
2015-09-01 22:55 Gnomi Note Added: 0002263
2015-09-01 22:56 Gnomi Assigned To => Gnomi
2015-09-01 22:56 Gnomi Status new => assigned
2015-09-06 05:44 _xtian_ Note Added: 0002264
2015-09-07 19:31 Source_changeset_attached => ldmud.git master 595561dd
2015-09-07 19:32 Gnomi Status assigned => resolved
2015-09-07 19:32 Gnomi Resolution open => fixed
2018-01-29 19:59 Gnomi Source_changeset_attached => ldmud.git master 595561dd
2018-01-29 22:57 Gnomi Source_changeset_attached => ldmud.git master 595561dd
2018-01-30 04:59 Gnomi Source_changeset_attached => ldmud.git master 595561dd
2019-08-29 23:39 Gnomi Relationship added related to 0000049