Complete
over 3 years ago

This is already a known issue currently.

Strange type checker behavior

If you build the following with type checking enabled:

import Toybox.Lang;

class Strange {
    private var foo as String = "";

    function x(d as Dictionary<Symbol,String>) as String {
        return (d[:foo] as String) + (d[:bar] as String);
    }
}

you get:

WARNING: <device>: bug.mc:7: Unable to detect scope for the symbol reference 'foo'.

It only warns if there's a class variable of the same name in scope (so we get a warning for foo, but not bar). There doesn't seem to be any point to the warning, since :foo has no scope - the whole point is that symbols are global - and there's certainly no connection between the d[:foo] and the class variable foo.