The 4.0.7 release notes say:
- Add type checking to ‘object[:variable]’ syntax
But now I get warnings from:
function getField(info as Object, field as Symbol) {
if (info has field) {
return info[field];
}
return null;
}
WARNING: <device>: bug.mc:3: Cannot determine if container access is using container type.
Since we've checked that the field exists, there shouldn't be a need to check the container type (and it could be a class, and not a container at all).
I get the same warning using a literal symbol (obviously I could rewrite this one as info.field):
function getField(info as Object) {
if (info has :field) {
return info[:field];
}
return null;
}
There doesn't seem to be a way to suppress this warning. The docs mention (:typechecker(options)), but I cant find any documentation for options - other than disableBackgroundCheck and disableGlanceCheck - and I haven't been able to guess an option that helps.