microsoft / microsoft/pxt-microbit

Array isn't getting inferred in python

Open
#3,745 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

python
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Describe the bug
This is a user reported bug from Twitter - https://twitter.com/JudianneTeach/status/1328887954333261825

The script is trying to remove an item from an array. After fixing an initial syntax error, we still can't pop an item out of the array.

To Reproduce
Steps to reproduce the behavior:

  1. Open this script: https://makecode.microbit.org/_7rgXkF8yD0Kj
  2. There's an error - can't find function "letter_bag.pop", even though pop is a supported array function

image
image

micro:bit version (please complete the following information):
not hardware related

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the linked MakeCode script first and reproduce the missing letter_bag.pop error in Python mode. Trace how the array is inferred and how supported array methods are resolved; done means the script recognizes pop without the reported function error and the regression is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.