Using
istype
with one argument, when that one argument is a chain of variable access including ?
, produces a strange compiler error involving 'unknown variable type' with a blank type.Numbered Steps to Reproduce Problem:
1. Attempt to use
istype
to verify the type of a var on something, while using ?
to access the var on the thing2. Non-descriptive compiler error
Code Snippet (if applicable) to Reproduce Problem:
/datum/test
var/datum/field = null
proc/main()
var/datum/test/inst = new
inst.field = new
world.log << istype(inst?.field)
Expected Results:
1 is printed to world.log
Actual Results:
compiler error:
error: : unknown variable type
Does the problem occur:
Occurs on two tested computers, consistently on every compile.
Occurs regardless of length of chain (i.e.
istype(foo?.bar)
and istype(foo.bar?.baz)
produce the same error)When does the problem NOT occur?
Occurs every time when passing one argument to
istype
; works fine with two arguments.Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Occurred in every tested version, down to 513.1490
Workarounds:
Nullchecking the thing before using istype(), I suppose.