SpacemanDMM icon indicating copy to clipboard operation
SpacemanDMM copied to clipboard

Sleep detection does not catch some child overrides.

Open afterthought2 opened this issue 4 years ago • 3 comments

The following example does not detect any issues (v0.1.10 VSCode extension):

/proc/foo()
	set SpacemanDMM_should_not_sleep = TRUE
	var/test/test = new /test/sub()
	test.baz()

/test/proc/baz()

/test/sub/baz()
	bar()

/test/proc/bar()
	sleep(1)

It seems this should have been fixed in #214, but the example suggests some cases are missed. The simpler

/proc/foo()
	set SpacemanDMM_should_not_sleep = TRUE
	var/test/test = new /test/sub()
	test.baz()

/test/proc/baz()

/test/sub/baz()
	sleep(1)

does detect the sleep.

afterthought2 avatar Feb 17 '21 05:02 afterthought2

@afterthought2 this happens because you are make a /test/sub but storing it in a /test typed var, it's a limitation I keep trying to overcome but it's incredibly complicated to do static analysis of types

spookydonut avatar Mar 10 '21 08:03 spookydonut

The places where this comes up involve things like

/foo
    var/path // subtype of bar

/foo/proc/make()
    var/bar/bar = new path()

where it's not possible to fully type the var. I realize that performing static analysis that fully accounts for all possibilities here is difficult/expensive, but if it becomes possible it would be very useful for us.

afterthought2 avatar Mar 13 '21 02:03 afterthought2

It won't be possible unless someone smarter than me can figure out how to do that kind of very advanced static analysis

spookydonut avatar Mar 20 '21 19:03 spookydonut