ID:2777389
 
Resolved
Expressions such as istype(a?.b) did not correctly infer the var type.
BYOND Version:514
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 99.0.4844.82
Applies to:Dream Maker
Status: Resolved (514.1584)

This issue has been resolved.
Descriptive Problem Summary:
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 thing
2. 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.
Lummox JR resolved issue with message:
Expressions such as istype(a?.b) did not correctly infer the var type.