New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Unknown constant type <class 'frozenset'> in function definition #849

Merged
merged 3 commits into from Jul 13, 2018

Conversation

Projects
None yet
2 participants
@BPYap
Contributor

BPYap commented Jun 26, 2018

Previously when a set/frozenset appears as a constant in function definition, voc will fail during transpilation, for example, the code below will raise AssertionError: Unknown constant type <class 'frozenset'> during transpilation:

def func():
    1 in {1, 2, 3, 4, 5, 6}

This PR solve this issue by converting frozenset constant to a tuple when blocks.add_tuple is executing.

elif isinstance(value, bytes):
elif isinstance(value, frozenset):
self.add_opcodes(
python.Set(),

This comment has been minimized.

@freakboy3742

freakboy3742 Jul 6, 2018

Member

Shouldn't this be FrozenSet?

@@ -181,6 +181,58 @@ def add_tuple(self, data):
java.Init('java/util/ArrayList'),
)
def add_value(val):

This comment has been minimized.

@freakboy3742

freakboy3742 Jul 6, 2018

Member

It's better to avoid inner methods if you can.

@freakboy3742

👍

@freakboy3742 freakboy3742 merged commit df96c08 into pybee:master Jul 13, 2018

5 checks passed

beekeeper:0/beefore:javacheckstyle Java lint checks passed.
Details
beekeeper:0/beefore:pycodestyle Python lint checks passed.
Details
beekeeper:1/smoke-test Smoke build (Python 3.4) passed.
Details
beekeeper:2/full-test:py3.5 Python 3.5 tests passed.
Details
beekeeper:2/full-test:py3.6 Python 3.6 tests passed.
Details

@BPYap BPYap deleted the BPYap:fix-frozenset-in-function-definition branch Jul 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment