Description
Describe the bug
Arising from support ticket https://support.microbit.org/helpdesk/tickets/83988 (private)
This example cannot be compiled - shows “wrong uses: 1 1”
It fails in earlier MakeCode versions back to v3 with "Compilation failed, please check your code for errors"
This project was created in v7
https://makecode.microbit.org/_b5440xhxoC9j
This project was created in v3.
https://makecode.microbit.org/_7RLdkpXdLfJL
From the ticket...
If the function is called with a constant, e,g, call to test(2), then no issue.
If the function is modified to return the input value, no issue arises.
If the function is changed to return the cube of a number by the same, chained multiplication of the input number, no error results.
The math functions “+” and “-“ are not affected by this, however “*”. “/” & “**” are.
A work round is to introduce a temporary variable to hold the result of the calculation and return that.
To Reproduce
Steps to reproduce the behavior:
- Go to https://makecode.microbit.org/_b5440xhxoC9j
- Click on Download or Save
- See error
Expected behavior
Compilation succeeds
micro:bit version (please complete the following information):
not hardware related
Desktop (please complete the following information):
- OS: [e.g. iOS] Windows
- Browser [e.g. chrome, safari] Chrome
- Version [e.g. 22]