Acknowledged

Fix the static functions

Hi CIQ team,

The static functions are broken for a long time now, it would be a good thing to fix them and be able to use them as in other languages Slight smile

Best regards

  • Wow! All fixed in sdk 6.3.0! Respect! Thanks!

  • Please fix the last bug... it is terrible to not be able to access to class members static functions like that...!

  • UPDATE FOR SDK 6.2.2 (2/3 fixed)

    import Toybox.Lang;
    import Toybox.System;
    
    // (:typecheck(false))
    class TestStatic {
        
        public static const PARAMETER_NAME = "name";
    
        private var _data as Dictionary<String,String>;
    
        public function initialize() {
            _data = new Dictionary() as Dictionary<String,String>;
        }
    
        public function setName(value as String) as Void {
            _data.put(PARAMETER_NAME, value);
        }
    
    
        // NOT FIXED!!!!!
        // Case1 (Create in static, singletone): Cannot find symbol ':setName' on type '$.TestStatic'
        public static function create(name as String) as TestStatic {
            var instance = new TestStatic();
            instance.setName(name);
    
            return instance;
        }
    
        // FIXED!!!!!
        // Case2 (Static call as helper): Cannot find symbol ':uniqueIdentifier' on type '$.Toybox.System.DeviceSettings'
        public static function getDeviceUniqueId() as String? {
            return System.getDeviceSettings().uniqueIdentifier;
        }
    
        // FIXED!!!!!
        // Case3 (Static call as helper with object): Cannot find symbol ':put' on type '$.Toybox.Lang.Dictionary<$.Toybox.Lang.String,$.Toybox.Lang.String>'
        public static function setDefaultHeaders(headers as Dictionary<String,String>) as Void
        {
            headers.put("Content-Type", "application/json");
        }
    }
    

  • Static functions work, but if you use :typecheck(false) annotation :DDD

    import Toybox.Lang;
    import Toybox.System;
    
    // (:typecheck(false))
    class TestStatic {
        
        public static const PARAMETER_NAME = "name";
    
        private var _data as Dictionary<String,String>;
    
        public function initialize() {
            _data = new Dictionary() as Dictionary<String,String>;
        }
    
        public function setName(value as String) as Void {
            _data.put(PARAMETER_NAME, value);
        }
    
    
        // Case1 (Create in static, singletone): Cannot find symbol ':setName' on type '$.TestStatic'
        public static function create(name as String) as TestStatic {
            var instance = new TestStatic();
            instance.setName(name);
    
            return instance;
        }
    
        // Case2 (Static call as helper): Cannot find symbol ':uniqueIdentifier' on type '$.Toybox.System.DeviceSettings'
        public static function getDeviceUniqueId() as String? {
            return System.getDeviceSettings().uniqueIdentifier;
        }
    
        // Case3 (Static call as helper with object): Cannot find symbol ':put' on type '$.Toybox.Lang.Dictionary<$.Toybox.Lang.String,$.Toybox.Lang.String>'
        public static function setDefaultHeaders(headers as Dictionary<String,String>) as Void
        {
            headers.put("Content-Type", "application/json");
        }
    }
    

    But of course it's terrible.