OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Lint for `list += new`

Open Mothblocks opened this issue 2 years ago • 5 comments

var/list/mob/mobs = list()
mobs += new

This actually translates to mobs += list(), because typed lists aren't real.

Mothblocks avatar Mar 26 '23 23:03 Mothblocks

OD already throws an error for this.

ike709 avatar Mar 26 '23 23:03 ike709

Is it a separate error code that can be #pragma'd?

wixoaGit avatar Mar 26 '23 23:03 wixoaGit

It's a side effect from something else, and the error message on it is confusing and unwieldy and should still be considered an issue

image

Mothblocks avatar Mar 26 '23 23:03 Mothblocks

https://github.com/OpenDreamProject/OpenDream/issues/1127

ike709 avatar Mar 27 '23 00:03 ike709

That error happens any time you use an inferred new where a type can't be inferred

For example:

var/foo = new()

This isn't quite the same as a lint for the example in the issue, and actually seems to be a bug since it should infer a /list type.

wixoaGit avatar Mar 27 '23 02:03 wixoaGit