Makopo/lslint

Show error for list in list

Closed this issue · 5 comments

lslint should report an error for:

default
{
    state_entry()
    {
        list items = [(list)1];
        llSay(PUBLIC_CHANNEL, llList2CSV(items));
    }
}

Suggestion:

  • check for explicit casts to list
  • check for functions that return a list

SL behavior:

  • script compiles, but crashes

Tested with v1.0.8.

This looks like a dup of #36.

Can you clarify this, please?

  • check for explicit casts to list
  • check for functions that return a list

My understanding is that the situation to catch is a list constructor [ ... ] containing any element of type list, isn't that so? For example, this should also be caught:

    list a;
    list b = [a];

That too, yes.

Catching that and user-defined functions that return lists would require keeping track of variable and function types, though.

It's a bit easier to catch if there's an explicit cast to list or a built-in function that returns a list.

Catching that and user-defined functions that return lists would require keeping track of variable and function types, though.

The good news is that lslint already does that :)

I have a patch ready. I'll submit it soon.