QUERY · ISSUE
Type Inference issue when using struct in viper
bug
MY_TYPE = {
"var": 0 | uctypes.UINT32
}
storage = bytearray(uctypes.sizeof(MY_TYPE))
@micropython.viper
def bugreport():
data = uctypes.struct(ptr32(storage), MY_TYPE)
data.var += int(1)
bugreport()
For some reason data.var is an object even though it's type is clearly defined from the struct. the following error occurs:
ViperTypeError: can\'t do binary op between \'object\' and \'int\'
CANDIDATE · ISSUE
viper: ViperTypeError: can't do binary op between 'uint' and 'uint'
The following produces the above error at compile time (only with uints - compiles and runs with int)
@micropython.viper
def foo(arg1: uint, arg2: uint) -> uint:
return arg1 + arg2
MicroPython v1.6-35-ge372e83 on 2016-02-11; PYBv1.0 with STM32F405RG