superacli 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/adapter-schema.test.js +2 -0
- package/__tests__/config.test.js +62 -1
- package/__tests__/help-json.test.js +2 -0
- package/__tests__/mcp-adapter.test.js +14 -4
- package/__tests__/mcp-local.test.js +159 -0
- package/__tests__/mcp-stdio-jsonrpc.test.js +105 -0
- package/__tests__/monty-plugin.test.js +121 -0
- package/__tests__/plugin-browser-use-uninstall.test.js +23 -0
- package/__tests__/plugin-browser-use.test.js +77 -0
- package/__tests__/plugins-command.test.js +92 -1
- package/__tests__/plugins-learn.test.js +62 -0
- package/__tests__/plugins-registry.test.js +3 -1
- package/__tests__/resend-plugin.test.js +122 -0
- package/__tests__/skills.test.js +4 -0
- package/cli/adapter-schema.js +3 -2
- package/cli/adapters/mcp.js +22 -3
- package/cli/adapters/process.js +34 -7
- package/cli/config.js +27 -1
- package/cli/help-json.js +2 -2
- package/cli/mcp-diagnostics.js +152 -0
- package/cli/mcp-discovery.js +221 -0
- package/cli/mcp-local.js +267 -25
- package/cli/mcp-stdio-jsonrpc.js +246 -0
- package/cli/plugin-install-guidance.js +25 -0
- package/cli/plugins-command.js +86 -3
- package/cli/plugins-learn.js +177 -0
- package/cli/plugins-manager.js +3 -0
- package/cli/plugins-registry.js +2 -1
- package/cli/skills-mcp.js +102 -0
- package/cli/skills.js +6 -40
- package/cli/supercli.js +7 -2
- package/docs/initial/mcp-local-mode.md +35 -0
- package/docs/mcp-cheatsheet.md +324 -0
- package/docs/plugins.md +7 -0
- package/package.json +1 -1
- package/plugins/browser-use/plugin.json +23 -0
- package/plugins/browser-use/scripts/post-install.js +146 -0
- package/plugins/browser-use/scripts/post-uninstall.js +28 -0
- package/plugins/browser-use/skills/quickstart/SKILL.md +47 -0
- package/plugins/monty/README.md +49 -0
- package/plugins/monty/plugin.json +69 -0
- package/plugins/monty/scripts/post-install.js +73 -0
- package/plugins/monty/scripts/post-uninstall.js +23 -0
- package/plugins/monty/scripts/run-python.js +140 -0
- package/plugins/monty/scripts/setup-monty.js +27 -0
- package/plugins/plugins.json +29 -0
- package/plugins/resend/plugin.json +371 -0
- package/plugins/resend/scripts/post-install.js +59 -0
- package/plugins/resend/scripts/post-uninstall.js +23 -0
- package/plugins/resend/scripts/setup-resend.js +27 -0
- package/plugins/resend/skills/quickstart/SKILL.md +80 -0
- package/ref-monty/.cargo/config.toml +3 -0
- package/ref-monty/.claude/settings.json +60 -0
- package/ref-monty/.claude/skills/fastmod/SKILL.md +22 -0
- package/ref-monty/.claude/skills/python-playground/SKILL.md +47 -0
- package/ref-monty/.codecov.yml +12 -0
- package/ref-monty/.github/actions/build-pgo-wheel/action.yml +72 -0
- package/ref-monty/.github/workflows/ci.yml +776 -0
- package/ref-monty/.github/workflows/codspeed.yml +45 -0
- package/ref-monty/.github/workflows/init-npm-packages.yml +82 -0
- package/ref-monty/.pre-commit-config.yaml +47 -0
- package/ref-monty/.python-version +1 -0
- package/ref-monty/.rustfmt.toml +4 -0
- package/ref-monty/.zed/settings.json +11 -0
- package/ref-monty/CLAUDE.md +535 -0
- package/ref-monty/Cargo.lock +3798 -0
- package/ref-monty/Cargo.toml +87 -0
- package/ref-monty/LICENSE +21 -0
- package/ref-monty/Makefile +216 -0
- package/ref-monty/README.md +430 -0
- package/ref-monty/RELEASING.md +47 -0
- package/ref-monty/crates/fuzz/Cargo.toml +30 -0
- package/ref-monty/crates/fuzz/fuzz_targets/string_input_panic.rs +37 -0
- package/ref-monty/crates/fuzz/fuzz_targets/tokens_input_panic.rs +552 -0
- package/ref-monty/crates/monty/Cargo.toml +68 -0
- package/ref-monty/crates/monty/benches/main.rs +247 -0
- package/ref-monty/crates/monty/build.rs +10 -0
- package/ref-monty/crates/monty/src/args.rs +733 -0
- package/ref-monty/crates/monty/src/asyncio.rs +179 -0
- package/ref-monty/crates/monty/src/builtins/abs.rs +55 -0
- package/ref-monty/crates/monty/src/builtins/all.rs +30 -0
- package/ref-monty/crates/monty/src/builtins/any.rs +30 -0
- package/ref-monty/crates/monty/src/builtins/bin.rs +59 -0
- package/ref-monty/crates/monty/src/builtins/chr.rs +46 -0
- package/ref-monty/crates/monty/src/builtins/divmod.rs +164 -0
- package/ref-monty/crates/monty/src/builtins/enumerate.rs +52 -0
- package/ref-monty/crates/monty/src/builtins/filter.rs +67 -0
- package/ref-monty/crates/monty/src/builtins/getattr.rs +65 -0
- package/ref-monty/crates/monty/src/builtins/hash.rs +28 -0
- package/ref-monty/crates/monty/src/builtins/hex.rs +58 -0
- package/ref-monty/crates/monty/src/builtins/id.rs +24 -0
- package/ref-monty/crates/monty/src/builtins/isinstance.rs +68 -0
- package/ref-monty/crates/monty/src/builtins/len.rs +25 -0
- package/ref-monty/crates/monty/src/builtins/map.rs +98 -0
- package/ref-monty/crates/monty/src/builtins/min_max.rs +113 -0
- package/ref-monty/crates/monty/src/builtins/mod.rs +246 -0
- package/ref-monty/crates/monty/src/builtins/next.rs +21 -0
- package/ref-monty/crates/monty/src/builtins/oct.rs +59 -0
- package/ref-monty/crates/monty/src/builtins/ord.rs +67 -0
- package/ref-monty/crates/monty/src/builtins/pow.rs +365 -0
- package/ref-monty/crates/monty/src/builtins/print.rs +141 -0
- package/ref-monty/crates/monty/src/builtins/repr.rs +16 -0
- package/ref-monty/crates/monty/src/builtins/reversed.rs +28 -0
- package/ref-monty/crates/monty/src/builtins/round.rs +174 -0
- package/ref-monty/crates/monty/src/builtins/sorted.rs +151 -0
- package/ref-monty/crates/monty/src/builtins/sum.rs +66 -0
- package/ref-monty/crates/monty/src/builtins/type_.rs +16 -0
- package/ref-monty/crates/monty/src/builtins/zip.rs +77 -0
- package/ref-monty/crates/monty/src/bytecode/builder.rs +699 -0
- package/ref-monty/crates/monty/src/bytecode/code.rs +310 -0
- package/ref-monty/crates/monty/src/bytecode/compiler.rs +3206 -0
- package/ref-monty/crates/monty/src/bytecode/mod.rs +24 -0
- package/ref-monty/crates/monty/src/bytecode/op.rs +617 -0
- package/ref-monty/crates/monty/src/bytecode/vm/async_exec.rs +1058 -0
- package/ref-monty/crates/monty/src/bytecode/vm/attr.rs +63 -0
- package/ref-monty/crates/monty/src/bytecode/vm/binary.rs +487 -0
- package/ref-monty/crates/monty/src/bytecode/vm/call.rs +767 -0
- package/ref-monty/crates/monty/src/bytecode/vm/collections.rs +741 -0
- package/ref-monty/crates/monty/src/bytecode/vm/compare.rs +147 -0
- package/ref-monty/crates/monty/src/bytecode/vm/exceptions.rs +297 -0
- package/ref-monty/crates/monty/src/bytecode/vm/format.rs +132 -0
- package/ref-monty/crates/monty/src/bytecode/vm/mod.rs +1958 -0
- package/ref-monty/crates/monty/src/bytecode/vm/scheduler.rs +620 -0
- package/ref-monty/crates/monty/src/exception_private.rs +1513 -0
- package/ref-monty/crates/monty/src/exception_public.rs +346 -0
- package/ref-monty/crates/monty/src/expressions.rs +694 -0
- package/ref-monty/crates/monty/src/fstring.rs +854 -0
- package/ref-monty/crates/monty/src/function.rs +119 -0
- package/ref-monty/crates/monty/src/heap.rs +1073 -0
- package/ref-monty/crates/monty/src/heap_data.rs +985 -0
- package/ref-monty/crates/monty/src/heap_traits.rs +312 -0
- package/ref-monty/crates/monty/src/intern.rs +837 -0
- package/ref-monty/crates/monty/src/io.rs +106 -0
- package/ref-monty/crates/monty/src/lib.rs +52 -0
- package/ref-monty/crates/monty/src/modules/asyncio.rs +144 -0
- package/ref-monty/crates/monty/src/modules/math.rs +1453 -0
- package/ref-monty/crates/monty/src/modules/mod.rs +120 -0
- package/ref-monty/crates/monty/src/modules/os.rs +116 -0
- package/ref-monty/crates/monty/src/modules/pathlib.rs +33 -0
- package/ref-monty/crates/monty/src/modules/re.rs +606 -0
- package/ref-monty/crates/monty/src/modules/sys.rs +60 -0
- package/ref-monty/crates/monty/src/modules/typing.rs +70 -0
- package/ref-monty/crates/monty/src/namespace.rs +21 -0
- package/ref-monty/crates/monty/src/object.rs +1040 -0
- package/ref-monty/crates/monty/src/os.rs +215 -0
- package/ref-monty/crates/monty/src/parse.rs +1730 -0
- package/ref-monty/crates/monty/src/prepare.rs +3015 -0
- package/ref-monty/crates/monty/src/repl.rs +1109 -0
- package/ref-monty/crates/monty/src/resource.rs +559 -0
- package/ref-monty/crates/monty/src/run.rs +457 -0
- package/ref-monty/crates/monty/src/run_progress.rs +821 -0
- package/ref-monty/crates/monty/src/signature.rs +651 -0
- package/ref-monty/crates/monty/src/sorting.rs +100 -0
- package/ref-monty/crates/monty/src/types/bytes.rs +2356 -0
- package/ref-monty/crates/monty/src/types/dataclass.rs +345 -0
- package/ref-monty/crates/monty/src/types/dict.rs +879 -0
- package/ref-monty/crates/monty/src/types/dict_view.rs +619 -0
- package/ref-monty/crates/monty/src/types/iter.rs +799 -0
- package/ref-monty/crates/monty/src/types/list.rs +929 -0
- package/ref-monty/crates/monty/src/types/long_int.rs +211 -0
- package/ref-monty/crates/monty/src/types/mod.rs +48 -0
- package/ref-monty/crates/monty/src/types/module.rs +146 -0
- package/ref-monty/crates/monty/src/types/namedtuple.rs +261 -0
- package/ref-monty/crates/monty/src/types/path.rs +596 -0
- package/ref-monty/crates/monty/src/types/property.rs +35 -0
- package/ref-monty/crates/monty/src/types/py_trait.rs +322 -0
- package/ref-monty/crates/monty/src/types/range.rs +285 -0
- package/ref-monty/crates/monty/src/types/re_match.rs +522 -0
- package/ref-monty/crates/monty/src/types/re_pattern.rs +726 -0
- package/ref-monty/crates/monty/src/types/set.rs +1373 -0
- package/ref-monty/crates/monty/src/types/slice.rs +257 -0
- package/ref-monty/crates/monty/src/types/str.rs +2051 -0
- package/ref-monty/crates/monty/src/types/tuple.rs +376 -0
- package/ref-monty/crates/monty/src/types/type.rs +407 -0
- package/ref-monty/crates/monty/src/value.rs +2558 -0
- package/ref-monty/crates/monty/test_cases/args__dict_get_no_args.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__dict_get_too_many.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__dict_items_with_args.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__dict_keys_with_args.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__dict_pop_no_args.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__dict_pop_too_many.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__dict_values_with_args.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__id_too_many.py +2 -0
- package/ref-monty/crates/monty/test_cases/args__len_no_args.py +2 -0
- package/ref-monty/crates/monty/test_cases/args__len_too_many.py +2 -0
- package/ref-monty/crates/monty/test_cases/args__len_type_error_int.py +9 -0
- package/ref-monty/crates/monty/test_cases/args__len_type_error_none.py +9 -0
- package/ref-monty/crates/monty/test_cases/args__list_append_no_args.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__list_append_too_many.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__list_insert_too_few.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__list_insert_too_many.py +3 -0
- package/ref-monty/crates/monty/test_cases/args__repr_no_args.py +2 -0
- package/ref-monty/crates/monty/test_cases/arith__div_zero_float.py +2 -0
- package/ref-monty/crates/monty/test_cases/arith__div_zero_int.py +2 -0
- package/ref-monty/crates/monty/test_cases/arith__floordiv_zero_float.py +2 -0
- package/ref-monty/crates/monty/test_cases/arith__floordiv_zero_int.py +2 -0
- package/ref-monty/crates/monty/test_cases/arith__pow_zero_neg.py +2 -0
- package/ref-monty/crates/monty/test_cases/arith__pow_zero_neg_builtin.py +9 -0
- package/ref-monty/crates/monty/test_cases/assert__expr_fail.py +2 -0
- package/ref-monty/crates/monty/test_cases/assert__fail.py +2 -0
- package/ref-monty/crates/monty/test_cases/assert__fail_msg.py +2 -0
- package/ref-monty/crates/monty/test_cases/assert__fn_fail.py +3 -0
- package/ref-monty/crates/monty/test_cases/assert__ops.py +11 -0
- package/ref-monty/crates/monty/test_cases/async__asyncio_run.py +47 -0
- package/ref-monty/crates/monty/test_cases/async__basic.py +10 -0
- package/ref-monty/crates/monty/test_cases/async__closure.py +14 -0
- package/ref-monty/crates/monty/test_cases/async__double_await_coroutine.py +16 -0
- package/ref-monty/crates/monty/test_cases/async__exception.py +10 -0
- package/ref-monty/crates/monty/test_cases/async__ext_call.py +73 -0
- package/ref-monty/crates/monty/test_cases/async__gather_all.py +85 -0
- package/ref-monty/crates/monty/test_cases/async__nested_await.py +15 -0
- package/ref-monty/crates/monty/test_cases/async__nested_gather_ext.py +37 -0
- package/ref-monty/crates/monty/test_cases/async__not_awaitable.py +10 -0
- package/ref-monty/crates/monty/test_cases/async__not_imported.py +14 -0
- package/ref-monty/crates/monty/test_cases/async__recursion_depth_isolation.py +27 -0
- package/ref-monty/crates/monty/test_cases/async__return_types.py +31 -0
- package/ref-monty/crates/monty/test_cases/async__sequential.py +16 -0
- package/ref-monty/crates/monty/test_cases/async__traceback.py +19 -0
- package/ref-monty/crates/monty/test_cases/async__with_args.py +14 -0
- package/ref-monty/crates/monty/test_cases/attr__get_int_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/attr__get_list_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/attr__set_frozen_nonfield.py +12 -0
- package/ref-monty/crates/monty/test_cases/attr__set_int_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/attr__set_list_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/bench__kitchen_sink.py +68 -0
- package/ref-monty/crates/monty/test_cases/bool__ops.py +20 -0
- package/ref-monty/crates/monty/test_cases/builtin__add_type_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/builtin__filter.py +62 -0
- package/ref-monty/crates/monty/test_cases/builtin__filter_not_iterable.py +11 -0
- package/ref-monty/crates/monty/test_cases/builtin__getattr.py +84 -0
- package/ref-monty/crates/monty/test_cases/builtin__iter_funcs.py +42 -0
- package/ref-monty/crates/monty/test_cases/builtin__iter_next.py +66 -0
- package/ref-monty/crates/monty/test_cases/builtin__map.py +74 -0
- package/ref-monty/crates/monty/test_cases/builtin__map_not_iterable.py +11 -0
- package/ref-monty/crates/monty/test_cases/builtin__math_funcs.py +154 -0
- package/ref-monty/crates/monty/test_cases/builtin__more_iter_funcs.py +148 -0
- package/ref-monty/crates/monty/test_cases/builtin__next_stop_iteration.py +10 -0
- package/ref-monty/crates/monty/test_cases/builtin__print_invalid_kwarg.py +9 -0
- package/ref-monty/crates/monty/test_cases/builtin__print_kwargs.py +12 -0
- package/ref-monty/crates/monty/test_cases/builtin__repr.py +3 -0
- package/ref-monty/crates/monty/test_cases/builtin__string_funcs.py +73 -0
- package/ref-monty/crates/monty/test_cases/bytes__decode_invalid_utf8.py +18 -0
- package/ref-monty/crates/monty/test_cases/bytes__endswith_str_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/bytes__getitem_index_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/bytes__index_start_gt_end.py +10 -0
- package/ref-monty/crates/monty/test_cases/bytes__methods.py +394 -0
- package/ref-monty/crates/monty/test_cases/bytes__negative_count.py +9 -0
- package/ref-monty/crates/monty/test_cases/bytes__ops.py +90 -0
- package/ref-monty/crates/monty/test_cases/bytes__startswith_str_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/call_object.py +3 -0
- package/ref-monty/crates/monty/test_cases/chain_comparison__all.py +79 -0
- package/ref-monty/crates/monty/test_cases/closure__param_shadows_outer.py +81 -0
- package/ref-monty/crates/monty/test_cases/closure__pep448.py +203 -0
- package/ref-monty/crates/monty/test_cases/closure__undefined_nonlocal.py +13 -0
- package/ref-monty/crates/monty/test_cases/compare__mixed_types.py +120 -0
- package/ref-monty/crates/monty/test_cases/comprehension__all.py +208 -0
- package/ref-monty/crates/monty/test_cases/comprehension__scope.py +7 -0
- package/ref-monty/crates/monty/test_cases/comprehension__unbound_local.py +14 -0
- package/ref-monty/crates/monty/test_cases/dataclass__basic.py +238 -0
- package/ref-monty/crates/monty/test_cases/dataclass__call_field_error.py +12 -0
- package/ref-monty/crates/monty/test_cases/dataclass__frozen_set_error.py +12 -0
- package/ref-monty/crates/monty/test_cases/dataclass__get_missing_attr_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/dict__get_unhashable_key.py +3 -0
- package/ref-monty/crates/monty/test_cases/dict__literal_unhashable_key.py +2 -0
- package/ref-monty/crates/monty/test_cases/dict__method_pop_missing_error.py +3 -0
- package/ref-monty/crates/monty/test_cases/dict__methods.py +151 -0
- package/ref-monty/crates/monty/test_cases/dict__ops.py +133 -0
- package/ref-monty/crates/monty/test_cases/dict__pop_unhashable_key.py +4 -0
- package/ref-monty/crates/monty/test_cases/dict__popitem_empty.py +9 -0
- package/ref-monty/crates/monty/test_cases/dict__subscript_missing_key.py +3 -0
- package/ref-monty/crates/monty/test_cases/dict__unhashable_dict_key.py +2 -0
- package/ref-monty/crates/monty/test_cases/dict__unhashable_list_key.py +2 -0
- package/ref-monty/crates/monty/test_cases/dict__unpack_type_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/dict__views.py +165 -0
- package/ref-monty/crates/monty/test_cases/edge__all.py +26 -0
- package/ref-monty/crates/monty/test_cases/edge__float_int_mod.py +2 -0
- package/ref-monty/crates/monty/test_cases/edge__int_float_mod.py +2 -0
- package/ref-monty/crates/monty/test_cases/exc__args.py +16 -0
- package/ref-monty/crates/monty/test_cases/exc__str.py +15 -0
- package/ref-monty/crates/monty/test_cases/execute_ok__all.py +54 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__error_instance_str.py +2 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__error_no_args.py +2 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__error_string_arg.py +2 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__error_string_arg_quotes.py +2 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__error_type.py +2 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__raise_instance_via_var.py +4 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__raise_list.py +2 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__raise_number.py +2 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__raise_type_call_via_var.py +4 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__raise_type_direct.py +3 -0
- package/ref-monty/crates/monty/test_cases/execute_raise__raise_type_via_var.py +4 -0
- package/ref-monty/crates/monty/test_cases/ext_call__arg_side_effect_bug.py +22 -0
- package/ref-monty/crates/monty/test_cases/ext_call__augmented.py +17 -0
- package/ref-monty/crates/monty/test_cases/ext_call__augmented_refcount_bug.py +7 -0
- package/ref-monty/crates/monty/test_cases/ext_call__bare_raise_after_resume.py +34 -0
- package/ref-monty/crates/monty/test_cases/ext_call__basic.py +99 -0
- package/ref-monty/crates/monty/test_cases/ext_call__boolean.py +37 -0
- package/ref-monty/crates/monty/test_cases/ext_call__boolean_side_effect_hang.py +17 -0
- package/ref-monty/crates/monty/test_cases/ext_call__closure_bug.py +16 -0
- package/ref-monty/crates/monty/test_cases/ext_call__comparison.py +26 -0
- package/ref-monty/crates/monty/test_cases/ext_call__deep_call_stack.py +18 -0
- package/ref-monty/crates/monty/test_cases/ext_call__elif.py +171 -0
- package/ref-monty/crates/monty/test_cases/ext_call__exc.py +4 -0
- package/ref-monty/crates/monty/test_cases/ext_call__exc_deep_stack.py +39 -0
- package/ref-monty/crates/monty/test_cases/ext_call__exc_in_function.py +17 -0
- package/ref-monty/crates/monty/test_cases/ext_call__exc_nested_functions.py +31 -0
- package/ref-monty/crates/monty/test_cases/ext_call__ext_exc.py +171 -0
- package/ref-monty/crates/monty/test_cases/ext_call__for.py +114 -0
- package/ref-monty/crates/monty/test_cases/ext_call__fstring.py +12 -0
- package/ref-monty/crates/monty/test_cases/ext_call__if.py +135 -0
- package/ref-monty/crates/monty/test_cases/ext_call__if_condition.py +37 -0
- package/ref-monty/crates/monty/test_cases/ext_call__in_closure.py +14 -0
- package/ref-monty/crates/monty/test_cases/ext_call__in_function.py +40 -0
- package/ref-monty/crates/monty/test_cases/ext_call__in_function_simple.py +7 -0
- package/ref-monty/crates/monty/test_cases/ext_call__literals.py +17 -0
- package/ref-monty/crates/monty/test_cases/ext_call__multi_in_func.py +32 -0
- package/ref-monty/crates/monty/test_cases/ext_call__name_lookup.py +69 -0
- package/ref-monty/crates/monty/test_cases/ext_call__name_lookup_undefined.py +4 -0
- package/ref-monty/crates/monty/test_cases/ext_call__nested_calls.py +14 -0
- package/ref-monty/crates/monty/test_cases/ext_call__recursion_bug.py +19 -0
- package/ref-monty/crates/monty/test_cases/ext_call__return.py +28 -0
- package/ref-monty/crates/monty/test_cases/ext_call__side_effects.py +25 -0
- package/ref-monty/crates/monty/test_cases/ext_call__subscript.py +7 -0
- package/ref-monty/crates/monty/test_cases/ext_call__ternary.py +28 -0
- package/ref-monty/crates/monty/test_cases/ext_call__try.py +280 -0
- package/ref-monty/crates/monty/test_cases/ext_call__try_simple.py +10 -0
- package/ref-monty/crates/monty/test_cases/ext_call__unary.py +13 -0
- package/ref-monty/crates/monty/test_cases/frozenset__ops.py +178 -0
- package/ref-monty/crates/monty/test_cases/fstring__all.py +236 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_eq_align_on_str.py +3 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_float_f_on_str.py +3 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_int_d_on_float.py +3 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_int_d_on_str.py +3 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_invalid_spec.py +4 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_invalid_spec_dynamic.py +4 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_invalid_spec_str.py +4 -0
- package/ref-monty/crates/monty/test_cases/fstring__error_str_s_on_int.py +3 -0
- package/ref-monty/crates/monty/test_cases/function__call_duplicate_kwargs.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__call_unpack.py +42 -0
- package/ref-monty/crates/monty/test_cases/function__defaults.py +117 -0
- package/ref-monty/crates/monty/test_cases/function__err_duplicate_arg.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_duplicate_first_arg.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_duplicate_kwarg_cleanup.py +9 -0
- package/ref-monty/crates/monty/test_cases/function__err_kwonly_as_positional.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_missing_all_posonly.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_missing_heap_cleanup.py +9 -0
- package/ref-monty/crates/monty/test_cases/function__err_missing_kwonly.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_missing_posonly_with_kwarg.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_missing_with_posonly.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_posonly_as_kwarg.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_posonly_first_as_kwarg.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_too_many_posonly.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_too_many_with_kwonly.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_unexpected_kwarg.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_unexpected_kwarg_cleanup.py +9 -0
- package/ref-monty/crates/monty/test_cases/function__err_unexpected_kwarg_quote.py +13 -0
- package/ref-monty/crates/monty/test_cases/function__err_unexpected_kwarg_simple.py +7 -0
- package/ref-monty/crates/monty/test_cases/function__err_unpack_duplicate_arg.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__err_unpack_duplicate_heap.py +8 -0
- package/ref-monty/crates/monty/test_cases/function__err_unpack_int.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__err_unpack_nonstring_key.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__err_unpack_not_mapping.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__kwargs_unpacking.py +173 -0
- package/ref-monty/crates/monty/test_cases/function__ops.py +294 -0
- package/ref-monty/crates/monty/test_cases/function__return_none.py +42 -0
- package/ref-monty/crates/monty/test_cases/function__signatures.py +47 -0
- package/ref-monty/crates/monty/test_cases/function__too_few_args_all.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__too_few_args_one.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__too_few_args_two.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__too_many_args_one.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__too_many_args_two.py +6 -0
- package/ref-monty/crates/monty/test_cases/function__too_many_args_zero.py +6 -0
- package/ref-monty/crates/monty/test_cases/global__error_assigned_before.py +7 -0
- package/ref-monty/crates/monty/test_cases/global__ops.py +163 -0
- package/ref-monty/crates/monty/test_cases/hash__dict_unhashable.py +2 -0
- package/ref-monty/crates/monty/test_cases/hash__list_unhashable.py +2 -0
- package/ref-monty/crates/monty/test_cases/hash__ops.py +153 -0
- package/ref-monty/crates/monty/test_cases/id__bytes_literals_distinct.py +3 -0
- package/ref-monty/crates/monty/test_cases/id__int_copy_distinct.py +5 -0
- package/ref-monty/crates/monty/test_cases/id__is_number_is_number.py +3 -0
- package/ref-monty/crates/monty/test_cases/id__non_overlapping_lifetimes_distinct_types.py +10 -0
- package/ref-monty/crates/monty/test_cases/id__non_overlapping_lifetimes_same_types.py +6 -0
- package/ref-monty/crates/monty/test_cases/id__ops.py +97 -0
- package/ref-monty/crates/monty/test_cases/id__str_literals_same.py +3 -0
- package/ref-monty/crates/monty/test_cases/if__elif_else.py +207 -0
- package/ref-monty/crates/monty/test_cases/if__raise_elif.py +11 -0
- package/ref-monty/crates/monty/test_cases/if__raise_else.py +13 -0
- package/ref-monty/crates/monty/test_cases/if__raise_if.py +9 -0
- package/ref-monty/crates/monty/test_cases/if__raise_in_elif_condition.py +18 -0
- package/ref-monty/crates/monty/test_cases/if__raise_in_if_condition.py +16 -0
- package/ref-monty/crates/monty/test_cases/if_else_expr__all.py +55 -0
- package/ref-monty/crates/monty/test_cases/import__error_cannot_import.py +9 -0
- package/ref-monty/crates/monty/test_cases/import__error_module_not_found.py +9 -0
- package/ref-monty/crates/monty/test_cases/import__local_scope.py +68 -0
- package/ref-monty/crates/monty/test_cases/import__os.py +25 -0
- package/ref-monty/crates/monty/test_cases/import__relative_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/import__relative_no_module_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/import__runtime_error_when_executed.py +14 -0
- package/ref-monty/crates/monty/test_cases/import__star_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/import__sys.py +47 -0
- package/ref-monty/crates/monty/test_cases/import__sys_monty.py +28 -0
- package/ref-monty/crates/monty/test_cases/import__type_checking_guard.py +37 -0
- package/ref-monty/crates/monty/test_cases/import__typing.py +25 -0
- package/ref-monty/crates/monty/test_cases/import__typing_type_ignore.py +4 -0
- package/ref-monty/crates/monty/test_cases/int__bigint.py +467 -0
- package/ref-monty/crates/monty/test_cases/int__bigint_errors.py +260 -0
- package/ref-monty/crates/monty/test_cases/int__ops.py +219 -0
- package/ref-monty/crates/monty/test_cases/int__overflow_division.py +84 -0
- package/ref-monty/crates/monty/test_cases/is_variant__all.py +36 -0
- package/ref-monty/crates/monty/test_cases/isinstance__arg2_list_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/isinstance__arg2_type_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/iter__dict_mutation.py +4 -0
- package/ref-monty/crates/monty/test_cases/iter__for.py +243 -0
- package/ref-monty/crates/monty/test_cases/iter__for_loop_unpacking.py +66 -0
- package/ref-monty/crates/monty/test_cases/iter__generator_expr.py +20 -0
- package/ref-monty/crates/monty/test_cases/iter__generator_expr_type.py +7 -0
- package/ref-monty/crates/monty/test_cases/iter__not_iterable.py +3 -0
- package/ref-monty/crates/monty/test_cases/lambda__all.py +145 -0
- package/ref-monty/crates/monty/test_cases/list__extend_not_iterable.py +7 -0
- package/ref-monty/crates/monty/test_cases/list__getitem_out_of_bounds.py +3 -0
- package/ref-monty/crates/monty/test_cases/list__index_not_found.py +9 -0
- package/ref-monty/crates/monty/test_cases/list__index_start_gt_end.py +10 -0
- package/ref-monty/crates/monty/test_cases/list__ops.py +473 -0
- package/ref-monty/crates/monty/test_cases/list__pop_empty.py +9 -0
- package/ref-monty/crates/monty/test_cases/list__pop_out_of_range.py +9 -0
- package/ref-monty/crates/monty/test_cases/list__pop_type_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/list__remove_not_found.py +9 -0
- package/ref-monty/crates/monty/test_cases/list__setitem_dict_index.py +13 -0
- package/ref-monty/crates/monty/test_cases/list__setitem_huge_int_index.py +13 -0
- package/ref-monty/crates/monty/test_cases/list__setitem_index_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/list__setitem_type_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/list__unpack_type_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/longint__index_error.py +3 -0
- package/ref-monty/crates/monty/test_cases/longint__repeat_error.py +3 -0
- package/ref-monty/crates/monty/test_cases/loop__break_continue.py +113 -0
- package/ref-monty/crates/monty/test_cases/loop__break_finally.py +69 -0
- package/ref-monty/crates/monty/test_cases/loop__break_in_function_error.py +13 -0
- package/ref-monty/crates/monty/test_cases/loop__break_in_if_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/loop__break_nested_except_clears.py +55 -0
- package/ref-monty/crates/monty/test_cases/loop__break_outside_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/loop__continue_finally.py +81 -0
- package/ref-monty/crates/monty/test_cases/loop__continue_in_function_error.py +13 -0
- package/ref-monty/crates/monty/test_cases/loop__continue_in_if_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/loop__continue_nested_except_clears.py +60 -0
- package/ref-monty/crates/monty/test_cases/loop__continue_outside_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/math__acos_domain_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__acosh_domain_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__asin_domain_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__atanh_domain_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__cos_inf_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__cosh_overflow_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__exp_overflow_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__factorial_float_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__factorial_negative_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__floor_inf_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__floor_nan_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__floor_str_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__fmod_inf_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__gamma_neg_int_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__gcd_float_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__isqrt_negative_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__ldexp_overflow_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__log1p_domain_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__log_base1_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__log_zero_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__module.py +1432 -0
- package/ref-monty/crates/monty/test_cases/math__pow_domain_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__sin_inf_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__sqrt_negative_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__tan_inf_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/math__trunc_str_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/method__args_kwargs_unpacking.py +259 -0
- package/ref-monty/crates/monty/test_cases/name_error__unbound_local_func.py +19 -0
- package/ref-monty/crates/monty/test_cases/name_error__unbound_local_module.py +12 -0
- package/ref-monty/crates/monty/test_cases/name_error__undefined_call_chained.py +9 -0
- package/ref-monty/crates/monty/test_cases/name_error__undefined_call_in_expr.py +9 -0
- package/ref-monty/crates/monty/test_cases/name_error__undefined_call_in_function.py +16 -0
- package/ref-monty/crates/monty/test_cases/name_error__undefined_call_with_args.py +9 -0
- package/ref-monty/crates/monty/test_cases/name_error__undefined_global.py +10 -0
- package/ref-monty/crates/monty/test_cases/namedtuple__missing_attr.py +11 -0
- package/ref-monty/crates/monty/test_cases/namedtuple__ops.py +34 -0
- package/ref-monty/crates/monty/test_cases/nonlocal__error_module_level.py +3 -0
- package/ref-monty/crates/monty/test_cases/nonlocal__ops.py +353 -0
- package/ref-monty/crates/monty/test_cases/os__environ.py +40 -0
- package/ref-monty/crates/monty/test_cases/os__getenv_key_list_error.py +5 -0
- package/ref-monty/crates/monty/test_cases/os__getenv_key_type_error.py +5 -0
- package/ref-monty/crates/monty/test_cases/parse_error__complex.py +3 -0
- package/ref-monty/crates/monty/test_cases/pathlib__import.py +11 -0
- package/ref-monty/crates/monty/test_cases/pathlib__os.py +136 -0
- package/ref-monty/crates/monty/test_cases/pathlib__os_read_error.py +12 -0
- package/ref-monty/crates/monty/test_cases/pathlib__pure.py +81 -0
- package/ref-monty/crates/monty/test_cases/pyobject__cycle_dict_self.py +5 -0
- package/ref-monty/crates/monty/test_cases/pyobject__cycle_list_dict.py +6 -0
- package/ref-monty/crates/monty/test_cases/pyobject__cycle_list_self.py +5 -0
- package/ref-monty/crates/monty/test_cases/pyobject__cycle_multiple_refs.py +6 -0
- package/ref-monty/crates/monty/test_cases/range__error_no_args.py +2 -0
- package/ref-monty/crates/monty/test_cases/range__error_step_zero.py +2 -0
- package/ref-monty/crates/monty/test_cases/range__error_too_many_args.py +2 -0
- package/ref-monty/crates/monty/test_cases/range__getitem_index_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/range__ops.py +236 -0
- package/ref-monty/crates/monty/test_cases/re__basic.py +756 -0
- package/ref-monty/crates/monty/test_cases/re__grouping.py +241 -0
- package/ref-monty/crates/monty/test_cases/re__match.py +148 -0
- package/ref-monty/crates/monty/test_cases/recursion__deep_drop.py +26 -0
- package/ref-monty/crates/monty/test_cases/recursion__deep_eq.py +23 -0
- package/ref-monty/crates/monty/test_cases/recursion__deep_hash.py +46 -0
- package/ref-monty/crates/monty/test_cases/recursion__deep_repr.py +12 -0
- package/ref-monty/crates/monty/test_cases/recursion__function_depth.py +13 -0
- package/ref-monty/crates/monty/test_cases/refcount__cycle_mutual_reference.py +18 -0
- package/ref-monty/crates/monty/test_cases/refcount__cycle_self_reference.py +12 -0
- package/ref-monty/crates/monty/test_cases/refcount__dict_basic.py +5 -0
- package/ref-monty/crates/monty/test_cases/refcount__dict_get.py +5 -0
- package/ref-monty/crates/monty/test_cases/refcount__dict_keys_and.py +14 -0
- package/ref-monty/crates/monty/test_cases/refcount__dict_overwrite.py +6 -0
- package/ref-monty/crates/monty/test_cases/refcount__gather_cleanup.py +16 -0
- package/ref-monty/crates/monty/test_cases/refcount__gather_exception.py +18 -0
- package/ref-monty/crates/monty/test_cases/refcount__gather_nested_cancel.py +25 -0
- package/ref-monty/crates/monty/test_cases/refcount__immediate_skipped.py +4 -0
- package/ref-monty/crates/monty/test_cases/refcount__kwargs_unpacking.py +27 -0
- package/ref-monty/crates/monty/test_cases/refcount__list_append_multiple.py +6 -0
- package/ref-monty/crates/monty/test_cases/refcount__list_append_ref.py +5 -0
- package/ref-monty/crates/monty/test_cases/refcount__list_concat.py +5 -0
- package/ref-monty/crates/monty/test_cases/refcount__list_getitem.py +5 -0
- package/ref-monty/crates/monty/test_cases/refcount__list_iadd.py +5 -0
- package/ref-monty/crates/monty/test_cases/refcount__nested_list.py +4 -0
- package/ref-monty/crates/monty/test_cases/refcount__re_pattern_sub_error_paths.py +37 -0
- package/ref-monty/crates/monty/test_cases/refcount__re_search_match.py +34 -0
- package/ref-monty/crates/monty/test_cases/refcount__re_sub_error_paths.py +31 -0
- package/ref-monty/crates/monty/test_cases/refcount__shared_reference.py +4 -0
- package/ref-monty/crates/monty/test_cases/refcount__single_list.py +3 -0
- package/ref-monty/crates/monty/test_cases/repr__cycle_detection.py +24 -0
- package/ref-monty/crates/monty/test_cases/set__ops.py +191 -0
- package/ref-monty/crates/monty/test_cases/set__review_bugs.py +35 -0
- package/ref-monty/crates/monty/test_cases/set__unpack_type_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/slice__invalid_indices.py +2 -0
- package/ref-monty/crates/monty/test_cases/slice__kwargs.py +9 -0
- package/ref-monty/crates/monty/test_cases/slice__no_args.py +9 -0
- package/ref-monty/crates/monty/test_cases/slice__ops.py +149 -0
- package/ref-monty/crates/monty/test_cases/slice__step_zero.py +9 -0
- package/ref-monty/crates/monty/test_cases/slice__step_zero_bytes.py +9 -0
- package/ref-monty/crates/monty/test_cases/slice__step_zero_range.py +9 -0
- package/ref-monty/crates/monty/test_cases/slice__step_zero_str.py +9 -0
- package/ref-monty/crates/monty/test_cases/slice__step_zero_tuple.py +9 -0
- package/ref-monty/crates/monty/test_cases/slice__too_many_args.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__getitem_index_error.py +10 -0
- package/ref-monty/crates/monty/test_cases/str__index_not_found.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__join_no_args.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__join_non_string.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__join_not_iterable.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__join_too_many_args.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__methods.py +327 -0
- package/ref-monty/crates/monty/test_cases/str__ops.py +162 -0
- package/ref-monty/crates/monty/test_cases/str__partition_empty.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__rsplit_empty_sep.py +9 -0
- package/ref-monty/crates/monty/test_cases/str__split_empty_sep.py +9 -0
- package/ref-monty/crates/monty/test_cases/sys__types.py +7 -0
- package/ref-monty/crates/monty/test_cases/traceback__division_error.py +30 -0
- package/ref-monty/crates/monty/test_cases/traceback__index_error.py +17 -0
- package/ref-monty/crates/monty/test_cases/traceback__insert_as_int.py +10 -0
- package/ref-monty/crates/monty/test_cases/traceback__nested_call.py +29 -0
- package/ref-monty/crates/monty/test_cases/traceback__nonlocal_module_scope.py +10 -0
- package/ref-monty/crates/monty/test_cases/traceback__nonlocal_unbound.py +24 -0
- package/ref-monty/crates/monty/test_cases/traceback__range_as_int.py +9 -0
- package/ref-monty/crates/monty/test_cases/traceback__recursion_error.py +23 -0
- package/ref-monty/crates/monty/test_cases/traceback__set_mutation.py +11 -0
- package/ref-monty/crates/monty/test_cases/traceback__undefined_attr_call.py +16 -0
- package/ref-monty/crates/monty/test_cases/traceback__undefined_call.py +16 -0
- package/ref-monty/crates/monty/test_cases/traceback__undefined_raise.py +16 -0
- package/ref-monty/crates/monty/test_cases/try_except__all.py +472 -0
- package/ref-monty/crates/monty/test_cases/try_except__bare_raise_no_context.py +2 -0
- package/ref-monty/crates/monty/test_cases/try_except__invalid_type.py +5 -0
- package/ref-monty/crates/monty/test_cases/tuple__getitem_out_of_bounds.py +3 -0
- package/ref-monty/crates/monty/test_cases/tuple__index_not_found.py +9 -0
- package/ref-monty/crates/monty/test_cases/tuple__index_start_gt_end.py +10 -0
- package/ref-monty/crates/monty/test_cases/tuple__methods.py +19 -0
- package/ref-monty/crates/monty/test_cases/tuple__ops.py +133 -0
- package/ref-monty/crates/monty/test_cases/tuple__unpack_type_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/type__builtin_attr_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/type__bytes_negative.py +2 -0
- package/ref-monty/crates/monty/test_cases/type__cell_not_builtin.py +9 -0
- package/ref-monty/crates/monty/test_cases/type__exception_attr_error.py +11 -0
- package/ref-monty/crates/monty/test_cases/type__float_conversion_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/type__float_repr_both_quotes.py +9 -0
- package/ref-monty/crates/monty/test_cases/type__float_repr_newline.py +9 -0
- package/ref-monty/crates/monty/test_cases/type__float_repr_single_quote.py +9 -0
- package/ref-monty/crates/monty/test_cases/type__int_conversion_error.py +2 -0
- package/ref-monty/crates/monty/test_cases/type__list_not_iterable.py +2 -0
- package/ref-monty/crates/monty/test_cases/type__non_builtin_name_error.py +9 -0
- package/ref-monty/crates/monty/test_cases/type__ops.py +200 -0
- package/ref-monty/crates/monty/test_cases/type__shadow_exc.py +3 -0
- package/ref-monty/crates/monty/test_cases/type__shadow_int.py +9 -0
- package/ref-monty/crates/monty/test_cases/type__shadow_len.py +3 -0
- package/ref-monty/crates/monty/test_cases/type__tuple_not_iterable.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__int_add_list.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__int_div_str.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__int_floordiv_str.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__int_iadd_str.py +3 -0
- package/ref-monty/crates/monty/test_cases/type_error__int_mod_str.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__int_pow_str.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__int_sub_str.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__list_add_int.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__list_add_str.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__list_iadd_int.py +6 -0
- package/ref-monty/crates/monty/test_cases/type_error__str_add_int.py +2 -0
- package/ref-monty/crates/monty/test_cases/type_error__str_iadd_int.py +3 -0
- package/ref-monty/crates/monty/test_cases/type_error__unary_invert_str.py +3 -0
- package/ref-monty/crates/monty/test_cases/type_error__unary_minus_str.py +4 -0
- package/ref-monty/crates/monty/test_cases/type_error__unary_neg_str.py +3 -0
- package/ref-monty/crates/monty/test_cases/type_error__unary_plus_str.py +4 -0
- package/ref-monty/crates/monty/test_cases/typing__types.py +24 -0
- package/ref-monty/crates/monty/test_cases/unpack__nested.py +48 -0
- package/ref-monty/crates/monty/test_cases/unpack__non_sequence.py +9 -0
- package/ref-monty/crates/monty/test_cases/unpack__not_enough.py +9 -0
- package/ref-monty/crates/monty/test_cases/unpack__ops.py +153 -0
- package/ref-monty/crates/monty/test_cases/unpack__star_not_enough.py +9 -0
- package/ref-monty/crates/monty/test_cases/unpack__too_many.py +9 -0
- package/ref-monty/crates/monty/test_cases/version__cpython.py +4 -0
- package/ref-monty/crates/monty/test_cases/walrus__all.py +178 -0
- package/ref-monty/crates/monty/test_cases/while__all.py +206 -0
- package/ref-monty/crates/monty/tests/asyncio.rs +764 -0
- package/ref-monty/crates/monty/tests/binary_serde.rs +185 -0
- package/ref-monty/crates/monty/tests/bytecode_limits.rs +248 -0
- package/ref-monty/crates/monty/tests/datatest_runner.rs +2029 -0
- package/ref-monty/crates/monty/tests/inputs.rs +420 -0
- package/ref-monty/crates/monty/tests/json_serde.rs +250 -0
- package/ref-monty/crates/monty/tests/main.rs +71 -0
- package/ref-monty/crates/monty/tests/math_module.rs +114 -0
- package/ref-monty/crates/monty/tests/name_lookup.rs +482 -0
- package/ref-monty/crates/monty/tests/os_tests.rs +459 -0
- package/ref-monty/crates/monty/tests/parse_errors.rs +441 -0
- package/ref-monty/crates/monty/tests/print_writer.rs +238 -0
- package/ref-monty/crates/monty/tests/py_object.rs +121 -0
- package/ref-monty/crates/monty/tests/regex.rs +90 -0
- package/ref-monty/crates/monty/tests/repl.rs +344 -0
- package/ref-monty/crates/monty/tests/resource_limits.rs +1826 -0
- package/ref-monty/crates/monty/tests/try_from.rs +167 -0
- package/ref-monty/crates/monty-cli/Cargo.toml +25 -0
- package/ref-monty/crates/monty-cli/src/main.rs +541 -0
- package/ref-monty/crates/monty-js/.cargo/config.toml +2 -0
- package/ref-monty/crates/monty-js/.prettierignore +8 -0
- package/ref-monty/crates/monty-js/Cargo.toml +32 -0
- package/ref-monty/crates/monty-js/README.md +207 -0
- package/ref-monty/crates/monty-js/__test__/async.spec.ts +350 -0
- package/ref-monty/crates/monty-js/__test__/basic.spec.ts +114 -0
- package/ref-monty/crates/monty-js/__test__/exceptions.spec.ts +427 -0
- package/ref-monty/crates/monty-js/__test__/external.spec.ts +354 -0
- package/ref-monty/crates/monty-js/__test__/inputs.spec.ts +143 -0
- package/ref-monty/crates/monty-js/__test__/limits.spec.ts +162 -0
- package/ref-monty/crates/monty-js/__test__/package.json +3 -0
- package/ref-monty/crates/monty-js/__test__/print.spec.ts +229 -0
- package/ref-monty/crates/monty-js/__test__/repl.spec.ts +34 -0
- package/ref-monty/crates/monty-js/__test__/serialize.spec.ts +205 -0
- package/ref-monty/crates/monty-js/__test__/start.spec.ts +443 -0
- package/ref-monty/crates/monty-js/__test__/type_check.spec.ts +147 -0
- package/ref-monty/crates/monty-js/__test__/types.spec.ts +319 -0
- package/ref-monty/crates/monty-js/build.rs +61 -0
- package/ref-monty/crates/monty-js/index-header.d.ts +3 -0
- package/ref-monty/crates/monty-js/package-lock.json +4694 -0
- package/ref-monty/crates/monty-js/package.json +100 -0
- package/ref-monty/crates/monty-js/scripts/smoke-test.sh +69 -0
- package/ref-monty/crates/monty-js/smoke-test/package.json +17 -0
- package/ref-monty/crates/monty-js/smoke-test/test.ts +171 -0
- package/ref-monty/crates/monty-js/smoke-test/tsconfig.json +11 -0
- package/ref-monty/crates/monty-js/src/convert.rs +648 -0
- package/ref-monty/crates/monty-js/src/exceptions.rs +293 -0
- package/ref-monty/crates/monty-js/src/lib.rs +41 -0
- package/ref-monty/crates/monty-js/src/limits.rs +53 -0
- package/ref-monty/crates/monty-js/src/monty_cls.rs +1407 -0
- package/ref-monty/crates/monty-js/tsconfig.json +17 -0
- package/ref-monty/crates/monty-js/wrapper.ts +701 -0
- package/ref-monty/crates/monty-python/Cargo.toml +38 -0
- package/ref-monty/crates/monty-python/README.md +134 -0
- package/ref-monty/crates/monty-python/build.rs +4 -0
- package/ref-monty/crates/monty-python/example.py +40 -0
- package/ref-monty/crates/monty-python/exercise.py +46 -0
- package/ref-monty/crates/monty-python/pyproject.toml +57 -0
- package/ref-monty/crates/monty-python/python/pydantic_monty/__init__.py +281 -0
- package/ref-monty/crates/monty-python/python/pydantic_monty/_monty.pyi +677 -0
- package/ref-monty/crates/monty-python/python/pydantic_monty/os_access.py +933 -0
- package/ref-monty/crates/monty-python/python/pydantic_monty/py.typed +0 -0
- package/ref-monty/crates/monty-python/src/convert.rs +273 -0
- package/ref-monty/crates/monty-python/src/dataclass.rs +461 -0
- package/ref-monty/crates/monty-python/src/exceptions.rs +557 -0
- package/ref-monty/crates/monty-python/src/external.rs +165 -0
- package/ref-monty/crates/monty-python/src/lib.rs +77 -0
- package/ref-monty/crates/monty-python/src/limits.rs +142 -0
- package/ref-monty/crates/monty-python/src/monty_cls.rs +1650 -0
- package/ref-monty/crates/monty-python/src/repl.rs +470 -0
- package/ref-monty/crates/monty-python/src/serialization.rs +761 -0
- package/ref-monty/crates/monty-python/tests/test_async.py +1201 -0
- package/ref-monty/crates/monty-python/tests/test_basic.py +66 -0
- package/ref-monty/crates/monty-python/tests/test_dataclasses.py +971 -0
- package/ref-monty/crates/monty-python/tests/test_exceptions.py +361 -0
- package/ref-monty/crates/monty-python/tests/test_external.py +367 -0
- package/ref-monty/crates/monty-python/tests/test_inputs.py +126 -0
- package/ref-monty/crates/monty-python/tests/test_limits.py +257 -0
- package/ref-monty/crates/monty-python/tests/test_os_access.py +1286 -0
- package/ref-monty/crates/monty-python/tests/test_os_access_compat.py +731 -0
- package/ref-monty/crates/monty-python/tests/test_os_access_raw.py +483 -0
- package/ref-monty/crates/monty-python/tests/test_os_calls.py +819 -0
- package/ref-monty/crates/monty-python/tests/test_print.py +208 -0
- package/ref-monty/crates/monty-python/tests/test_re.py +170 -0
- package/ref-monty/crates/monty-python/tests/test_readme_examples.py +20 -0
- package/ref-monty/crates/monty-python/tests/test_repl.py +749 -0
- package/ref-monty/crates/monty-python/tests/test_serialize.py +284 -0
- package/ref-monty/crates/monty-python/tests/test_start.py +346 -0
- package/ref-monty/crates/monty-python/tests/test_threading.py +163 -0
- package/ref-monty/crates/monty-python/tests/test_type_check.py +344 -0
- package/ref-monty/crates/monty-python/tests/test_types.py +553 -0
- package/ref-monty/crates/monty-type-checking/Cargo.toml +32 -0
- package/ref-monty/crates/monty-type-checking/src/db.rs +116 -0
- package/ref-monty/crates/monty-type-checking/src/lib.rs +4 -0
- package/ref-monty/crates/monty-type-checking/src/type_check.rs +280 -0
- package/ref-monty/crates/monty-type-checking/tests/bad_types.py +109 -0
- package/ref-monty/crates/monty-type-checking/tests/bad_types_output.txt +21 -0
- package/ref-monty/crates/monty-type-checking/tests/good_types.py +475 -0
- package/ref-monty/crates/monty-type-checking/tests/main.rs +205 -0
- package/ref-monty/crates/monty-type-checking/tests/reveal_types.py +56 -0
- package/ref-monty/crates/monty-type-checking/tests/reveal_types_output.txt +41 -0
- package/ref-monty/crates/monty-typeshed/Cargo.toml +29 -0
- package/ref-monty/crates/monty-typeshed/README.md +11 -0
- package/ref-monty/crates/monty-typeshed/build.rs +101 -0
- package/ref-monty/crates/monty-typeshed/custom/README.md +1 -0
- package/ref-monty/crates/monty-typeshed/custom/asyncio.pyi +138 -0
- package/ref-monty/crates/monty-typeshed/custom/os.pyi +87 -0
- package/ref-monty/crates/monty-typeshed/custom/sys.pyi +33 -0
- package/ref-monty/crates/monty-typeshed/src/lib.rs +56 -0
- package/ref-monty/crates/monty-typeshed/update.py +321 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/source_commit.txt +1 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/VERSIONS +20 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/_collections_abc.pyi +105 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/_typeshed/__init__.pyi +394 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/asyncio.pyi +138 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/builtins.pyi +1434 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/collections/__init__.pyi +527 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/collections/abc.pyi +2 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/dataclasses.pyi +502 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/enum.pyi +376 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/math.pyi +149 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/os.pyi +87 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/pathlib/__init__.pyi +395 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/pathlib/types.pyi +8 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/re.pyi +337 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/sys.pyi +33 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/types.pyi +741 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/typing.pyi +1217 -0
- package/ref-monty/crates/monty-typeshed/vendor/typeshed/stdlib/typing_extensions.pyi +716 -0
- package/ref-monty/docs/usage-guide.md +117 -0
- package/ref-monty/examples/README.md +3 -0
- package/ref-monty/examples/expense_analysis/README.md +3 -0
- package/ref-monty/examples/expense_analysis/data.py +124 -0
- package/ref-monty/examples/expense_analysis/main.py +115 -0
- package/ref-monty/examples/sql_playground/README.md +20 -0
- package/ref-monty/examples/sql_playground/external_functions.py +129 -0
- package/ref-monty/examples/sql_playground/main.py +81 -0
- package/ref-monty/examples/sql_playground/sandbox_code.py +82 -0
- package/ref-monty/examples/sql_playground/type_stubs.pyi +14 -0
- package/ref-monty/examples/web_scraper/README.md +15 -0
- package/ref-monty/examples/web_scraper/browser.py +56 -0
- package/ref-monty/examples/web_scraper/example_code.py +59 -0
- package/ref-monty/examples/web_scraper/external_functions.py +324 -0
- package/ref-monty/examples/web_scraper/main.py +193 -0
- package/ref-monty/examples/web_scraper/sub_agent.py +79 -0
- package/ref-monty/monty-npm.md +235 -0
- package/ref-monty/pyproject.toml +162 -0
- package/ref-monty/scripts/check_imports.py +91 -0
- package/ref-monty/scripts/codecov_diff.py +412 -0
- package/ref-monty/scripts/complete_tests.py +146 -0
- package/ref-monty/scripts/flamegraph_to_text.py +208 -0
- package/ref-monty/scripts/iter_test_methods.py +540 -0
- package/ref-monty/scripts/run_traceback.py +180 -0
- package/ref-monty/scripts/startup_performance.py +130 -0
- package/ref-monty/uv.lock +1779 -0
- package/temp_resend_cli/repo/.github/scripts/pr-title-check.js +34 -0
- package/temp_resend_cli/repo/.github/workflows/ci.yml +67 -0
- package/temp_resend_cli/repo/.github/workflows/post-release.yml +51 -0
- package/temp_resend_cli/repo/.github/workflows/pr-title-check.yml +13 -0
- package/temp_resend_cli/repo/.github/workflows/release.yml +175 -0
- package/temp_resend_cli/repo/.github/workflows/test-install-unix.yml +34 -0
- package/temp_resend_cli/repo/.github/workflows/test-install-windows.yml +48 -0
- package/temp_resend_cli/repo/CHANGELOG.md +31 -0
- package/temp_resend_cli/repo/LICENSE +21 -0
- package/temp_resend_cli/repo/README.md +450 -0
- package/temp_resend_cli/repo/biome.json +36 -0
- package/temp_resend_cli/repo/install.ps1 +141 -0
- package/temp_resend_cli/repo/install.sh +301 -0
- package/temp_resend_cli/repo/package.json +61 -0
- package/temp_resend_cli/repo/pnpm-lock.yaml +2439 -0
- package/temp_resend_cli/repo/renovate.json +4 -0
- package/temp_resend_cli/repo/src/cli.ts +98 -0
- package/temp_resend_cli/repo/src/commands/api-keys/create.ts +114 -0
- package/temp_resend_cli/repo/src/commands/api-keys/delete.ts +47 -0
- package/temp_resend_cli/repo/src/commands/api-keys/index.ts +26 -0
- package/temp_resend_cli/repo/src/commands/api-keys/list.ts +35 -0
- package/temp_resend_cli/repo/src/commands/api-keys/utils.ts +8 -0
- package/temp_resend_cli/repo/src/commands/auth/index.ts +20 -0
- package/temp_resend_cli/repo/src/commands/auth/login.ts +234 -0
- package/temp_resend_cli/repo/src/commands/auth/logout.ts +105 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/create.ts +196 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/delete.ts +46 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/get.ts +59 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/index.ts +43 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/list.ts +60 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/send.ts +56 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/update.ts +95 -0
- package/temp_resend_cli/repo/src/commands/broadcasts/utils.ts +35 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/create.ts +118 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/delete.ts +48 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/get.ts +46 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/index.ts +48 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/list.ts +68 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/update.ts +88 -0
- package/temp_resend_cli/repo/src/commands/contact-properties/utils.ts +17 -0
- package/temp_resend_cli/repo/src/commands/contacts/add-segment.ts +78 -0
- package/temp_resend_cli/repo/src/commands/contacts/create.ts +122 -0
- package/temp_resend_cli/repo/src/commands/contacts/delete.ts +49 -0
- package/temp_resend_cli/repo/src/commands/contacts/get.ts +53 -0
- package/temp_resend_cli/repo/src/commands/contacts/index.ts +58 -0
- package/temp_resend_cli/repo/src/commands/contacts/list.ts +57 -0
- package/temp_resend_cli/repo/src/commands/contacts/remove-segment.ts +48 -0
- package/temp_resend_cli/repo/src/commands/contacts/segments.ts +39 -0
- package/temp_resend_cli/repo/src/commands/contacts/topics.ts +45 -0
- package/temp_resend_cli/repo/src/commands/contacts/update-topics.ts +90 -0
- package/temp_resend_cli/repo/src/commands/contacts/update.ts +77 -0
- package/temp_resend_cli/repo/src/commands/contacts/utils.ts +119 -0
- package/temp_resend_cli/repo/src/commands/doctor.ts +216 -0
- package/temp_resend_cli/repo/src/commands/domains/create.ts +83 -0
- package/temp_resend_cli/repo/src/commands/domains/delete.ts +42 -0
- package/temp_resend_cli/repo/src/commands/domains/get.ts +47 -0
- package/temp_resend_cli/repo/src/commands/domains/index.ts +35 -0
- package/temp_resend_cli/repo/src/commands/domains/list.ts +53 -0
- package/temp_resend_cli/repo/src/commands/domains/update.ts +75 -0
- package/temp_resend_cli/repo/src/commands/domains/utils.ts +44 -0
- package/temp_resend_cli/repo/src/commands/domains/verify.ts +38 -0
- package/temp_resend_cli/repo/src/commands/emails/batch.ts +140 -0
- package/temp_resend_cli/repo/src/commands/emails/get.ts +44 -0
- package/temp_resend_cli/repo/src/commands/emails/index.ts +30 -0
- package/temp_resend_cli/repo/src/commands/emails/list.ts +84 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/attachment.ts +55 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/attachments.ts +68 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/get.ts +58 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/index.ts +28 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/list.ts +59 -0
- package/temp_resend_cli/repo/src/commands/emails/receiving/utils.ts +38 -0
- package/temp_resend_cli/repo/src/commands/emails/send.ts +189 -0
- package/temp_resend_cli/repo/src/commands/open.ts +27 -0
- package/temp_resend_cli/repo/src/commands/segments/create.ts +50 -0
- package/temp_resend_cli/repo/src/commands/segments/delete.ts +47 -0
- package/temp_resend_cli/repo/src/commands/segments/get.ts +38 -0
- package/temp_resend_cli/repo/src/commands/segments/index.ts +36 -0
- package/temp_resend_cli/repo/src/commands/segments/list.ts +58 -0
- package/temp_resend_cli/repo/src/commands/segments/utils.ts +7 -0
- package/temp_resend_cli/repo/src/commands/teams/index.ts +10 -0
- package/temp_resend_cli/repo/src/commands/teams/list.ts +35 -0
- package/temp_resend_cli/repo/src/commands/teams/remove.ts +86 -0
- package/temp_resend_cli/repo/src/commands/teams/switch.ts +76 -0
- package/temp_resend_cli/repo/src/commands/topics/create.ts +73 -0
- package/temp_resend_cli/repo/src/commands/topics/delete.ts +47 -0
- package/temp_resend_cli/repo/src/commands/topics/get.ts +42 -0
- package/temp_resend_cli/repo/src/commands/topics/index.ts +42 -0
- package/temp_resend_cli/repo/src/commands/topics/list.ts +34 -0
- package/temp_resend_cli/repo/src/commands/topics/update.ts +59 -0
- package/temp_resend_cli/repo/src/commands/topics/utils.ts +16 -0
- package/temp_resend_cli/repo/src/commands/webhooks/create.ts +128 -0
- package/temp_resend_cli/repo/src/commands/webhooks/delete.ts +49 -0
- package/temp_resend_cli/repo/src/commands/webhooks/get.ts +42 -0
- package/temp_resend_cli/repo/src/commands/webhooks/index.ts +42 -0
- package/temp_resend_cli/repo/src/commands/webhooks/list.ts +55 -0
- package/temp_resend_cli/repo/src/commands/webhooks/listen.ts +379 -0
- package/temp_resend_cli/repo/src/commands/webhooks/update.ts +83 -0
- package/temp_resend_cli/repo/src/commands/webhooks/utils.ts +36 -0
- package/temp_resend_cli/repo/src/commands/whoami.ts +71 -0
- package/temp_resend_cli/repo/src/lib/actions.ts +157 -0
- package/temp_resend_cli/repo/src/lib/client.ts +37 -0
- package/temp_resend_cli/repo/src/lib/config.ts +217 -0
- package/temp_resend_cli/repo/src/lib/files.ts +15 -0
- package/temp_resend_cli/repo/src/lib/help-text.ts +38 -0
- package/temp_resend_cli/repo/src/lib/output.ts +56 -0
- package/temp_resend_cli/repo/src/lib/pagination.ts +36 -0
- package/temp_resend_cli/repo/src/lib/prompts.ts +149 -0
- package/temp_resend_cli/repo/src/lib/spinner.ts +100 -0
- package/temp_resend_cli/repo/src/lib/table.ts +57 -0
- package/temp_resend_cli/repo/src/lib/tty.ts +28 -0
- package/temp_resend_cli/repo/src/lib/update-check.ts +169 -0
- package/temp_resend_cli/repo/src/lib/version.ts +4 -0
- package/temp_resend_cli/repo/tests/commands/api-keys/create.test.ts +196 -0
- package/temp_resend_cli/repo/tests/commands/api-keys/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/api-keys/list.test.ts +134 -0
- package/temp_resend_cli/repo/tests/commands/auth/login.test.ts +153 -0
- package/temp_resend_cli/repo/tests/commands/auth/logout.test.ts +153 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/create.test.ts +454 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/delete.test.ts +183 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/get.test.ts +147 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/list.test.ts +199 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/send.test.ts +162 -0
- package/temp_resend_cli/repo/tests/commands/broadcasts/update.test.ts +288 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/create.test.ts +251 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/delete.test.ts +184 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/get.test.ts +145 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/list.test.ts +181 -0
- package/temp_resend_cli/repo/tests/commands/contact-properties/update.test.ts +217 -0
- package/temp_resend_cli/repo/tests/commands/contacts/add-segment.test.ts +189 -0
- package/temp_resend_cli/repo/tests/commands/contacts/create.test.ts +271 -0
- package/temp_resend_cli/repo/tests/commands/contacts/delete.test.ts +193 -0
- package/temp_resend_cli/repo/tests/commands/contacts/get.test.ts +149 -0
- package/temp_resend_cli/repo/tests/commands/contacts/list.test.ts +176 -0
- package/temp_resend_cli/repo/tests/commands/contacts/remove-segment.test.ts +167 -0
- package/temp_resend_cli/repo/tests/commands/contacts/segments.test.ts +168 -0
- package/temp_resend_cli/repo/tests/commands/contacts/topics.test.ts +164 -0
- package/temp_resend_cli/repo/tests/commands/contacts/update-topics.test.ts +248 -0
- package/temp_resend_cli/repo/tests/commands/contacts/update.test.ts +206 -0
- package/temp_resend_cli/repo/tests/commands/doctor.test.ts +164 -0
- package/temp_resend_cli/repo/tests/commands/domains/create.test.ts +193 -0
- package/temp_resend_cli/repo/tests/commands/domains/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/domains/get.test.ts +138 -0
- package/temp_resend_cli/repo/tests/commands/domains/list.test.ts +165 -0
- package/temp_resend_cli/repo/tests/commands/domains/update.test.ts +224 -0
- package/temp_resend_cli/repo/tests/commands/domains/verify.test.ts +118 -0
- package/temp_resend_cli/repo/tests/commands/emails/batch.test.ts +324 -0
- package/temp_resend_cli/repo/tests/commands/emails/get.test.ts +132 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/attachment.test.ts +141 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/attachments.test.ts +169 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/get.test.ts +141 -0
- package/temp_resend_cli/repo/tests/commands/emails/receiving/list.test.ts +182 -0
- package/temp_resend_cli/repo/tests/commands/emails/send.test.ts +312 -0
- package/temp_resend_cli/repo/tests/commands/segments/create.test.ts +164 -0
- package/temp_resend_cli/repo/tests/commands/segments/delete.test.ts +183 -0
- package/temp_resend_cli/repo/tests/commands/segments/get.test.ts +138 -0
- package/temp_resend_cli/repo/tests/commands/segments/list.test.ts +174 -0
- package/temp_resend_cli/repo/tests/commands/teams/list.test.ts +62 -0
- package/temp_resend_cli/repo/tests/commands/teams/remove.test.ts +110 -0
- package/temp_resend_cli/repo/tests/commands/teams/switch.test.ts +103 -0
- package/temp_resend_cli/repo/tests/commands/topics/create.test.ts +192 -0
- package/temp_resend_cli/repo/tests/commands/topics/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/topics/get.test.ts +126 -0
- package/temp_resend_cli/repo/tests/commands/topics/list.test.ts +125 -0
- package/temp_resend_cli/repo/tests/commands/topics/update.test.ts +178 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/create.test.ts +225 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/delete.test.ts +157 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/get.test.ts +126 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/list.test.ts +178 -0
- package/temp_resend_cli/repo/tests/commands/webhooks/update.test.ts +207 -0
- package/temp_resend_cli/repo/tests/commands/whoami.test.ts +98 -0
- package/temp_resend_cli/repo/tests/e2e/smoke.test.ts +93 -0
- package/temp_resend_cli/repo/tests/helpers.ts +86 -0
- package/temp_resend_cli/repo/tests/lib/client.test.ts +71 -0
- package/temp_resend_cli/repo/tests/lib/config.test.ts +451 -0
- package/temp_resend_cli/repo/tests/lib/files.test.ts +73 -0
- package/temp_resend_cli/repo/tests/lib/help-text.test.ts +97 -0
- package/temp_resend_cli/repo/tests/lib/output.test.ts +136 -0
- package/temp_resend_cli/repo/tests/lib/prompts.test.ts +185 -0
- package/temp_resend_cli/repo/tests/lib/spinner.test.ts +166 -0
- package/temp_resend_cli/repo/tests/lib/table.test.ts +63 -0
- package/temp_resend_cli/repo/tests/lib/tty.test.ts +89 -0
- package/temp_resend_cli/repo/tests/lib/update-check.test.ts +179 -0
- package/temp_resend_cli/repo/tsconfig.json +14 -0
- package/temp_resend_cli/repo/vitest.config.e2e.ts +8 -0
- package/temp_resend_cli/repo/vitest.config.ts +10 -0
- package/tests/test-mcp-browser-use-smoke.sh +28 -56
- package/tests/test-monty-smoke.sh +32 -0
- package/tests/test-resend-smoke.sh +36 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
//! Builder for emitting bytecode during compilation.
|
|
2
|
+
//!
|
|
3
|
+
//! `CodeBuilder` provides methods for emitting opcodes and operands, handling
|
|
4
|
+
//! forward jumps with patching, and tracking source locations for tracebacks.
|
|
5
|
+
|
|
6
|
+
use std::collections::HashSet;
|
|
7
|
+
|
|
8
|
+
use super::{
|
|
9
|
+
code::{Code, ConstPool, ExceptionEntry, LocationEntry},
|
|
10
|
+
op::Opcode,
|
|
11
|
+
};
|
|
12
|
+
use crate::{intern::StringId, parse::CodeRange, value::Value};
|
|
13
|
+
|
|
14
|
+
/// Builder for emitting bytecode during compilation.
|
|
15
|
+
///
|
|
16
|
+
/// Handles encoding opcodes and operands into raw bytes, managing forward jumps
|
|
17
|
+
/// that need patching, and tracking source locations for traceback generation.
|
|
18
|
+
///
|
|
19
|
+
/// # Usage
|
|
20
|
+
///
|
|
21
|
+
/// ```ignore
|
|
22
|
+
/// let mut builder = CodeBuilder::new();
|
|
23
|
+
/// builder.set_location(some_range, None);
|
|
24
|
+
/// builder.emit(Opcode::LoadNone);
|
|
25
|
+
/// builder.emit_u8(Opcode::LoadLocal, 0);
|
|
26
|
+
/// let jump = builder.emit_jump(Opcode::JumpIfFalse);
|
|
27
|
+
/// // ... emit more code ...
|
|
28
|
+
/// builder.patch_jump(jump);
|
|
29
|
+
/// let code = builder.build(num_locals);
|
|
30
|
+
/// ```
|
|
31
|
+
#[derive(Debug, Default)]
|
|
32
|
+
pub struct CodeBuilder {
|
|
33
|
+
/// The bytecode being built.
|
|
34
|
+
bytecode: Vec<u8>,
|
|
35
|
+
|
|
36
|
+
/// Constants collected during compilation.
|
|
37
|
+
constants: Vec<Value>,
|
|
38
|
+
|
|
39
|
+
/// Source location entries for traceback generation.
|
|
40
|
+
location_table: Vec<LocationEntry>,
|
|
41
|
+
|
|
42
|
+
/// Exception handler entries.
|
|
43
|
+
exception_table: Vec<ExceptionEntry>,
|
|
44
|
+
|
|
45
|
+
/// Current source location (set before emitting instructions).
|
|
46
|
+
current_location: Option<CodeRange>,
|
|
47
|
+
|
|
48
|
+
/// Current focus location within the source range.
|
|
49
|
+
current_focus: Option<CodeRange>,
|
|
50
|
+
|
|
51
|
+
/// Current stack depth for tracking max stack usage.
|
|
52
|
+
current_stack_depth: u16,
|
|
53
|
+
|
|
54
|
+
/// Maximum stack depth seen during compilation.
|
|
55
|
+
max_stack_depth: u16,
|
|
56
|
+
|
|
57
|
+
/// Local variable names indexed by slot number.
|
|
58
|
+
///
|
|
59
|
+
/// Populated during compilation to enable proper NameError messages
|
|
60
|
+
/// when accessing undefined local variables.
|
|
61
|
+
local_names: Vec<Option<StringId>>,
|
|
62
|
+
|
|
63
|
+
/// Local variable slots that are assigned somewhere in this function.
|
|
64
|
+
///
|
|
65
|
+
/// Used to determine whether to raise `UnboundLocalError` or `NameError`
|
|
66
|
+
/// when loading an undefined local variable.
|
|
67
|
+
assigned_locals: HashSet<u16>,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
impl CodeBuilder {
|
|
71
|
+
/// Creates a new empty CodeBuilder.
|
|
72
|
+
#[must_use]
|
|
73
|
+
pub fn new() -> Self {
|
|
74
|
+
Self::default()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// Sets the current source location for subsequent instructions.
|
|
78
|
+
///
|
|
79
|
+
/// This location will be recorded in the location table when the next
|
|
80
|
+
/// instruction is emitted. Call this before emitting instructions that
|
|
81
|
+
/// correspond to source code.
|
|
82
|
+
pub fn set_location(&mut self, range: CodeRange, focus: Option<CodeRange>) {
|
|
83
|
+
self.current_location = Some(range);
|
|
84
|
+
self.current_focus = focus;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// Emits a no-operand instruction and updates stack depth tracking.
|
|
88
|
+
pub fn emit(&mut self, op: Opcode) {
|
|
89
|
+
self.record_location();
|
|
90
|
+
self.bytecode.push(op as u8);
|
|
91
|
+
// Track stack effect for opcodes with known fixed effects
|
|
92
|
+
if let Some(effect) = op.stack_effect() {
|
|
93
|
+
self.adjust_stack(effect);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/// Emits an instruction with a u8 operand and updates stack depth tracking.
|
|
98
|
+
pub fn emit_u8(&mut self, op: Opcode, operand: u8) {
|
|
99
|
+
self.record_location();
|
|
100
|
+
self.bytecode.push(op as u8);
|
|
101
|
+
self.bytecode.push(operand);
|
|
102
|
+
// Track stack effect - some need operand-based calculation
|
|
103
|
+
self.track_stack_effect_u8(op, operand);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// Emits an instruction with an i8 operand and updates stack depth tracking.
|
|
107
|
+
pub fn emit_i8(&mut self, op: Opcode, operand: i8) {
|
|
108
|
+
self.record_location();
|
|
109
|
+
self.bytecode.push(op as u8);
|
|
110
|
+
// Reinterpret i8 as u8 for bytecode encoding
|
|
111
|
+
self.bytecode.push(operand.to_ne_bytes()[0]);
|
|
112
|
+
// Track stack effect for opcodes with known fixed effects
|
|
113
|
+
if let Some(effect) = op.stack_effect() {
|
|
114
|
+
self.adjust_stack(effect);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/// Emits an instruction with two u8 operands and updates stack depth tracking.
|
|
119
|
+
///
|
|
120
|
+
/// Used for UnpackEx: before_count (u8) + after_count (u8)
|
|
121
|
+
pub fn emit_u8_u8(&mut self, op: Opcode, operand1: u8, operand2: u8) {
|
|
122
|
+
self.record_location();
|
|
123
|
+
self.bytecode.push(op as u8);
|
|
124
|
+
self.bytecode.push(operand1);
|
|
125
|
+
self.bytecode.push(operand2);
|
|
126
|
+
// UnpackEx: pops 1, pushes (before + 1 + after) = before + after + 1
|
|
127
|
+
// Net effect: before + after
|
|
128
|
+
if op == Opcode::UnpackEx {
|
|
129
|
+
self.adjust_stack(i16::from(operand1) + i16::from(operand2));
|
|
130
|
+
} else if let Some(effect) = op.stack_effect() {
|
|
131
|
+
self.adjust_stack(effect);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/// Emits an instruction with a u16 operand (little-endian) and updates stack depth tracking.
|
|
136
|
+
pub fn emit_u16(&mut self, op: Opcode, operand: u16) {
|
|
137
|
+
self.record_location();
|
|
138
|
+
self.bytecode.push(op as u8);
|
|
139
|
+
self.bytecode.extend_from_slice(&operand.to_le_bytes());
|
|
140
|
+
// Track stack effect - some need operand-based calculation
|
|
141
|
+
self.track_stack_effect_u16(op, operand);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/// Emits an instruction with a u16 operand followed by a u8 operand.
|
|
145
|
+
///
|
|
146
|
+
/// Used for MakeFunction: func_id (u16) + defaults_count (u8)
|
|
147
|
+
/// Used for CallAttr: attr_name_id (u16) + arg_count (u8)
|
|
148
|
+
pub fn emit_u16_u8(&mut self, op: Opcode, operand1: u16, operand2: u8) {
|
|
149
|
+
self.record_location();
|
|
150
|
+
self.bytecode.push(op as u8);
|
|
151
|
+
self.bytecode.extend_from_slice(&operand1.to_le_bytes());
|
|
152
|
+
self.bytecode.push(operand2);
|
|
153
|
+
// Track stack effects based on opcode
|
|
154
|
+
match op {
|
|
155
|
+
Opcode::MakeFunction => {
|
|
156
|
+
// pops defaults_count defaults, pushes function: 1 - defaults_count
|
|
157
|
+
self.adjust_stack(1 - i16::from(operand2));
|
|
158
|
+
}
|
|
159
|
+
Opcode::CallAttr => {
|
|
160
|
+
// pops obj + args, pushes result: 1 - (1 + arg_count) = -arg_count
|
|
161
|
+
self.adjust_stack(-i16::from(operand2));
|
|
162
|
+
}
|
|
163
|
+
_ => {
|
|
164
|
+
if let Some(effect) = op.stack_effect() {
|
|
165
|
+
self.adjust_stack(effect);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/// Emits an instruction with a u16 operand followed by two u8 operands.
|
|
172
|
+
///
|
|
173
|
+
/// Used for MakeClosure: func_id (u16) + defaults_count (u8) + cell_count (u8)
|
|
174
|
+
pub fn emit_u16_u8_u8(&mut self, op: Opcode, operand1: u16, operand2: u8, operand3: u8) {
|
|
175
|
+
self.record_location();
|
|
176
|
+
self.bytecode.push(op as u8);
|
|
177
|
+
self.bytecode.extend_from_slice(&operand1.to_le_bytes());
|
|
178
|
+
self.bytecode.push(operand2);
|
|
179
|
+
self.bytecode.push(operand3);
|
|
180
|
+
// MakeClosure: pops defaults_count defaults, pushes closure
|
|
181
|
+
// Cell values are captured from locals, not popped from stack
|
|
182
|
+
// Stack effect: 1 - defaults_count
|
|
183
|
+
if op == Opcode::MakeClosure {
|
|
184
|
+
self.adjust_stack(1 - i16::from(operand2));
|
|
185
|
+
} else if let Some(effect) = op.stack_effect() {
|
|
186
|
+
self.adjust_stack(effect);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/// Emits `CallBuiltinFunction` instruction.
|
|
191
|
+
///
|
|
192
|
+
/// Operands: builtin_id (u8) + arg_count (u8)
|
|
193
|
+
///
|
|
194
|
+
/// The builtin_id is the `#[repr(u8)]` discriminant of `BuiltinsFunctions`.
|
|
195
|
+
/// This is an optimization that avoids constant pool lookup and stack manipulation.
|
|
196
|
+
pub fn emit_call_builtin_function(&mut self, builtin_id: u8, arg_count: u8) {
|
|
197
|
+
self.record_location();
|
|
198
|
+
self.bytecode.push(Opcode::CallBuiltinFunction as u8);
|
|
199
|
+
self.bytecode.push(builtin_id);
|
|
200
|
+
self.bytecode.push(arg_count);
|
|
201
|
+
// CallBuiltinFunction: pops args, pushes result. No callable on stack.
|
|
202
|
+
// Stack effect: 1 - arg_count
|
|
203
|
+
self.adjust_stack(1 - i16::from(arg_count));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/// Emits `CallBuiltinType` instruction.
|
|
207
|
+
///
|
|
208
|
+
/// Operands: type_id (u8) + arg_count (u8)
|
|
209
|
+
///
|
|
210
|
+
/// The type_id is the `#[repr(u8)]` discriminant of `BuiltinsTypes`.
|
|
211
|
+
/// This is an optimization for type constructors like `list()`, `int()`, `str()`.
|
|
212
|
+
pub fn emit_call_builtin_type(&mut self, type_id: u8, arg_count: u8) {
|
|
213
|
+
self.record_location();
|
|
214
|
+
self.bytecode.push(Opcode::CallBuiltinType as u8);
|
|
215
|
+
self.bytecode.push(type_id);
|
|
216
|
+
self.bytecode.push(arg_count);
|
|
217
|
+
// CallBuiltinType: pops args, pushes result. No callable on stack.
|
|
218
|
+
// Stack effect: 1 - arg_count
|
|
219
|
+
self.adjust_stack(1 - i16::from(arg_count));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/// Emits CallFunctionKw with inline keyword names.
|
|
223
|
+
///
|
|
224
|
+
/// Operands: pos_count (u8) + kw_count (u8) + kw_count * name_id (u16 each)
|
|
225
|
+
///
|
|
226
|
+
/// The kwname_ids slice contains StringId indices for each keyword argument
|
|
227
|
+
/// name, in order matching how the values were pushed to the stack.
|
|
228
|
+
pub fn emit_call_function_kw(&mut self, pos_count: u8, kwname_ids: &[u16]) {
|
|
229
|
+
self.record_location();
|
|
230
|
+
self.bytecode.push(Opcode::CallFunctionKw as u8);
|
|
231
|
+
self.bytecode.push(pos_count);
|
|
232
|
+
self.bytecode
|
|
233
|
+
.push(u8::try_from(kwname_ids.len()).expect("keyword count exceeds u8"));
|
|
234
|
+
for &name_id in kwname_ids {
|
|
235
|
+
self.bytecode.extend_from_slice(&name_id.to_le_bytes());
|
|
236
|
+
}
|
|
237
|
+
// CallFunctionKw: pops callable + pos_args + kw_args, pushes result
|
|
238
|
+
// Stack effect: 1 - (1 + pos_count + kw_count) = -pos_count - kw_count
|
|
239
|
+
let kw_count = i16::try_from(kwname_ids.len()).expect("keyword count exceeds i16");
|
|
240
|
+
let total_args = i16::from(pos_count) + kw_count;
|
|
241
|
+
self.adjust_stack(-total_args);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/// Emits CallAttrKw with inline keyword names.
|
|
245
|
+
///
|
|
246
|
+
/// Operands: attr_name_id (u16) + pos_count (u8) + kw_count (u8) + kw_count * name_id (u16 each)
|
|
247
|
+
///
|
|
248
|
+
/// The kwname_ids slice contains StringId indices for each keyword argument
|
|
249
|
+
/// name, in order matching how the values were pushed to the stack.
|
|
250
|
+
pub fn emit_call_attr_kw(&mut self, attr_name_id: u16, pos_count: u8, kwname_ids: &[u16]) {
|
|
251
|
+
self.record_location();
|
|
252
|
+
self.bytecode.push(Opcode::CallAttrKw as u8);
|
|
253
|
+
self.bytecode.extend_from_slice(&attr_name_id.to_le_bytes());
|
|
254
|
+
self.bytecode.push(pos_count);
|
|
255
|
+
self.bytecode
|
|
256
|
+
.push(u8::try_from(kwname_ids.len()).expect("keyword count exceeds u8"));
|
|
257
|
+
for &name_id in kwname_ids {
|
|
258
|
+
self.bytecode.extend_from_slice(&name_id.to_le_bytes());
|
|
259
|
+
}
|
|
260
|
+
// CallAttrKw: pops obj + pos_args + kw_args, pushes result
|
|
261
|
+
// Stack effect: 1 - (1 + pos_count + kw_count) = -pos_count - kw_count
|
|
262
|
+
let kw_count = i16::try_from(kwname_ids.len()).expect("keyword count exceeds i16");
|
|
263
|
+
let total_args = i16::from(pos_count) + kw_count;
|
|
264
|
+
self.adjust_stack(-total_args);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/// Emits a forward jump instruction, returning a label to patch later.
|
|
268
|
+
///
|
|
269
|
+
/// The jump offset is initially set to 0 and must be patched with
|
|
270
|
+
/// `patch_jump()` once the target location is known.
|
|
271
|
+
#[must_use]
|
|
272
|
+
pub fn emit_jump(&mut self, op: Opcode) -> JumpLabel {
|
|
273
|
+
self.record_location();
|
|
274
|
+
let label = JumpLabel(self.bytecode.len());
|
|
275
|
+
self.bytecode.push(op as u8);
|
|
276
|
+
// Placeholder for i16 offset (will be patched)
|
|
277
|
+
self.bytecode.extend_from_slice(&0i16.to_le_bytes());
|
|
278
|
+
// Track stack effect
|
|
279
|
+
match op {
|
|
280
|
+
// ForIter: when successful (not jumping), pushes next value (+1)
|
|
281
|
+
// When exhausted (jumping), pops iterator (-1), but that's after loop
|
|
282
|
+
Opcode::ForIter => self.adjust_stack(1),
|
|
283
|
+
// JumpIfTrueOrPop/JumpIfFalseOrPop: pops when not jumping (fallthrough)
|
|
284
|
+
Opcode::JumpIfTrueOrPop | Opcode::JumpIfFalseOrPop => self.adjust_stack(-1),
|
|
285
|
+
_ => {
|
|
286
|
+
if let Some(effect) = op.stack_effect() {
|
|
287
|
+
self.adjust_stack(effect);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
label
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/// Patches a forward jump to point to the current bytecode location.
|
|
295
|
+
///
|
|
296
|
+
/// The offset is calculated relative to the position after the jump
|
|
297
|
+
/// instruction's operand (i.e., where execution would continue if
|
|
298
|
+
/// the jump is not taken).
|
|
299
|
+
///
|
|
300
|
+
/// # Panics
|
|
301
|
+
///
|
|
302
|
+
/// Panics if the jump offset exceeds i16 range (-32768..32767), which
|
|
303
|
+
/// indicates the function is too large. This is a compile-time error
|
|
304
|
+
/// rather than silent truncation.
|
|
305
|
+
pub fn patch_jump(&mut self, label: JumpLabel) {
|
|
306
|
+
let target = self.bytecode.len();
|
|
307
|
+
// Offset is relative to position after the jump instruction (opcode + i16 = 3 bytes)
|
|
308
|
+
let target_i64 = i64::try_from(target).expect("bytecode target exceeds i64");
|
|
309
|
+
let label_i64 = i64::try_from(label.0).expect("bytecode label exceeds i64");
|
|
310
|
+
let raw_offset = target_i64 - label_i64 - 3;
|
|
311
|
+
let offset =
|
|
312
|
+
i16::try_from(raw_offset).expect("jump offset exceeds i16 range (-32768..32767); function too large");
|
|
313
|
+
let bytes = offset.to_le_bytes();
|
|
314
|
+
self.bytecode[label.0 + 1] = bytes[0];
|
|
315
|
+
self.bytecode[label.0 + 2] = bytes[1];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/// Emits a backward jump to a known target offset.
|
|
319
|
+
///
|
|
320
|
+
/// Unlike forward jumps, backward jumps have a known target at emit time,
|
|
321
|
+
/// so no patching is needed.
|
|
322
|
+
pub fn emit_jump_to(&mut self, op: Opcode, target: usize) {
|
|
323
|
+
self.record_location();
|
|
324
|
+
let current = self.bytecode.len();
|
|
325
|
+
// Offset is relative to position after this instruction (current + 3)
|
|
326
|
+
let target_i64 = i64::try_from(target).expect("bytecode target exceeds i64");
|
|
327
|
+
let current_i64 = i64::try_from(current).expect("bytecode offset exceeds i64");
|
|
328
|
+
let raw_offset = target_i64 - (current_i64 + 3);
|
|
329
|
+
let offset =
|
|
330
|
+
i16::try_from(raw_offset).expect("jump offset exceeds i16 range (-32768..32767); function too large");
|
|
331
|
+
self.bytecode.push(op as u8);
|
|
332
|
+
self.bytecode.extend_from_slice(&offset.to_le_bytes());
|
|
333
|
+
// Track stack effect (jump instructions pop condition)
|
|
334
|
+
if let Some(effect) = op.stack_effect() {
|
|
335
|
+
self.adjust_stack(effect);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/// Returns the current bytecode offset.
|
|
340
|
+
///
|
|
341
|
+
/// Use this to record loop start positions for backward jumps.
|
|
342
|
+
#[must_use]
|
|
343
|
+
pub fn current_offset(&self) -> usize {
|
|
344
|
+
self.bytecode.len()
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/// Emits `LoadLocal`, using specialized opcodes for slots 0-3.
|
|
348
|
+
///
|
|
349
|
+
/// Slots 0-3 use zero-operand opcodes (`LoadLocal0`, etc.) for efficiency.
|
|
350
|
+
/// Slots 4-255 use `LoadLocal` with a u8 operand.
|
|
351
|
+
/// Slots 256+ use `LoadLocalW` with a u16 operand.
|
|
352
|
+
/// Registers a local variable name for a given slot.
|
|
353
|
+
///
|
|
354
|
+
/// This is called during compilation when we encounter a variable access.
|
|
355
|
+
/// The name is used to generate proper NameError messages.
|
|
356
|
+
pub fn register_local_name(&mut self, slot: u16, name: StringId) {
|
|
357
|
+
let slot_idx = slot as usize;
|
|
358
|
+
// Extend the vector if needed
|
|
359
|
+
if slot_idx >= self.local_names.len() {
|
|
360
|
+
self.local_names.resize(slot_idx + 1, None);
|
|
361
|
+
}
|
|
362
|
+
// Only set if not already set (first occurrence determines the name)
|
|
363
|
+
if self.local_names[slot_idx].is_none() {
|
|
364
|
+
self.local_names[slot_idx] = Some(name);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/// Registers a local variable slot as "assigned" (vs undefined reference).
|
|
369
|
+
///
|
|
370
|
+
/// Called during compilation for variables that are assigned somewhere in the function.
|
|
371
|
+
/// Used at runtime to determine whether to raise `UnboundLocalError` (assigned local
|
|
372
|
+
/// accessed before assignment) or `NameError` (name doesn't exist anywhere).
|
|
373
|
+
pub fn register_assigned_local(&mut self, slot: u16) {
|
|
374
|
+
self.assigned_locals.insert(slot);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/// Emits a `LoadLocal` instruction, using specialized variants for common slots.
|
|
378
|
+
pub fn emit_load_local(&mut self, slot: u16) {
|
|
379
|
+
match slot {
|
|
380
|
+
0 => self.emit(Opcode::LoadLocal0),
|
|
381
|
+
1 => self.emit(Opcode::LoadLocal1),
|
|
382
|
+
2 => self.emit(Opcode::LoadLocal2),
|
|
383
|
+
3 => self.emit(Opcode::LoadLocal3),
|
|
384
|
+
_ => {
|
|
385
|
+
if let Ok(s) = u8::try_from(slot) {
|
|
386
|
+
self.emit_u8(Opcode::LoadLocal, s);
|
|
387
|
+
} else {
|
|
388
|
+
self.emit_u16(Opcode::LoadLocalW, slot);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/// Emits a `LoadLocalCallable` instruction for call-context loads.
|
|
395
|
+
///
|
|
396
|
+
/// Unlike `emit_load_local`, this does NOT use specialized 0-3 variants since
|
|
397
|
+
/// external function calls are rare enough that the optimization isn't worth
|
|
398
|
+
/// the extra opcode slots. The `name_id` is encoded directly in the operand
|
|
399
|
+
/// to avoid needing to look up the name from the code's local_names array.
|
|
400
|
+
pub fn emit_load_local_callable(&mut self, slot: u16, name_id: StringId) {
|
|
401
|
+
let name_id_u16 = u16::try_from(name_id.index()).expect("name_id exceeds u16");
|
|
402
|
+
if let Ok(s) = u8::try_from(slot) {
|
|
403
|
+
// Emit LoadLocalCallable with u8 slot + u16 name_id
|
|
404
|
+
self.record_location();
|
|
405
|
+
self.bytecode.push(Opcode::LoadLocalCallable as u8);
|
|
406
|
+
self.bytecode.push(s);
|
|
407
|
+
self.bytecode.extend_from_slice(&name_id_u16.to_le_bytes());
|
|
408
|
+
self.adjust_stack(1);
|
|
409
|
+
} else {
|
|
410
|
+
// Emit LoadLocalCallableW with u16 slot + u16 name_id
|
|
411
|
+
self.record_location();
|
|
412
|
+
self.bytecode.push(Opcode::LoadLocalCallableW as u8);
|
|
413
|
+
self.bytecode.extend_from_slice(&slot.to_le_bytes());
|
|
414
|
+
self.bytecode.extend_from_slice(&name_id_u16.to_le_bytes());
|
|
415
|
+
self.adjust_stack(1);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/// Emits a `LoadGlobalCallable` instruction for call-context loads.
|
|
420
|
+
///
|
|
421
|
+
/// The `name_id` is encoded directly in the operand to avoid the ambiguity
|
|
422
|
+
/// of looking up global names from a function's local_names array (global slots
|
|
423
|
+
/// and local slots use different namespaces).
|
|
424
|
+
pub fn emit_load_global_callable(&mut self, slot: u16, name_id: StringId) {
|
|
425
|
+
let name_id_u16 = u16::try_from(name_id.index()).expect("name_id exceeds u16");
|
|
426
|
+
self.record_location();
|
|
427
|
+
self.bytecode.push(Opcode::LoadGlobalCallable as u8);
|
|
428
|
+
self.bytecode.extend_from_slice(&slot.to_le_bytes());
|
|
429
|
+
self.bytecode.extend_from_slice(&name_id_u16.to_le_bytes());
|
|
430
|
+
self.adjust_stack(1);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/// Emits `StoreLocal`, using wide variant for slots > 255.
|
|
434
|
+
pub fn emit_store_local(&mut self, slot: u16) {
|
|
435
|
+
if let Ok(s) = u8::try_from(slot) {
|
|
436
|
+
self.emit_u8(Opcode::StoreLocal, s);
|
|
437
|
+
} else {
|
|
438
|
+
self.emit_u16(Opcode::StoreLocalW, slot);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/// Adds a constant to the pool, returning its index.
|
|
443
|
+
///
|
|
444
|
+
/// # Panics
|
|
445
|
+
///
|
|
446
|
+
/// Panics if the constant pool exceeds 65535 entries. This is a compile-time
|
|
447
|
+
/// error indicating the function has too many constants.
|
|
448
|
+
#[must_use]
|
|
449
|
+
pub fn add_const(&mut self, value: Value) -> u16 {
|
|
450
|
+
let idx = self.constants.len();
|
|
451
|
+
let idx_u16 = u16::try_from(idx).expect("constant pool exceeds u16 range (65535); too many constants");
|
|
452
|
+
self.constants.push(value);
|
|
453
|
+
idx_u16
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/// Adds an exception handler entry.
|
|
457
|
+
///
|
|
458
|
+
/// Entries should be added in innermost-first order for nested try blocks.
|
|
459
|
+
pub fn add_exception_entry(&mut self, entry: ExceptionEntry) {
|
|
460
|
+
self.exception_table.push(entry);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/// Returns the current tracked stack depth.
|
|
464
|
+
#[must_use]
|
|
465
|
+
pub fn stack_depth(&self) -> u16 {
|
|
466
|
+
self.current_stack_depth
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/// Builds the final Code object.
|
|
470
|
+
///
|
|
471
|
+
/// Consumes the builder and returns a Code object containing the
|
|
472
|
+
/// compiled bytecode and all metadata.
|
|
473
|
+
#[must_use]
|
|
474
|
+
pub fn build(self, num_locals: u16) -> Code {
|
|
475
|
+
// Convert local_names from Vec<Option<StringId>> to Vec<StringId>,
|
|
476
|
+
// using StringId::default() for slots with no recorded name
|
|
477
|
+
let local_names: Vec<StringId> = self.local_names.into_iter().map(Option::unwrap_or_default).collect();
|
|
478
|
+
|
|
479
|
+
Code::new(
|
|
480
|
+
self.bytecode,
|
|
481
|
+
ConstPool::from_vec(self.constants),
|
|
482
|
+
self.location_table,
|
|
483
|
+
self.exception_table,
|
|
484
|
+
num_locals,
|
|
485
|
+
self.max_stack_depth,
|
|
486
|
+
local_names,
|
|
487
|
+
self.assigned_locals,
|
|
488
|
+
)
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/// Records the current location in the location table if set.
|
|
492
|
+
fn record_location(&mut self) {
|
|
493
|
+
if let Some(range) = self.current_location {
|
|
494
|
+
let offset = u32::try_from(self.bytecode.len()).expect("bytecode length exceeds u32");
|
|
495
|
+
self.location_table
|
|
496
|
+
.push(LocationEntry::new(offset, range, self.current_focus));
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/// Sets the current stack depth to an absolute value.
|
|
501
|
+
///
|
|
502
|
+
/// Used when compiling code paths that branch and reconverge with different
|
|
503
|
+
/// stack states (e.g., break/continue through finally blocks).
|
|
504
|
+
/// Updates `max_stack_depth` if the new depth exceeds it.
|
|
505
|
+
pub fn set_stack_depth(&mut self, depth: u16) {
|
|
506
|
+
self.current_stack_depth = depth;
|
|
507
|
+
self.max_stack_depth = self.max_stack_depth.max(depth);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/// Adjusts the stack depth by the given delta.
|
|
511
|
+
///
|
|
512
|
+
/// Positive values indicate pushes, negative values indicate pops.
|
|
513
|
+
/// Updates `max_stack_depth` if the new depth exceeds it.
|
|
514
|
+
fn adjust_stack(&mut self, delta: i16) {
|
|
515
|
+
let new_depth = i32::from(self.current_stack_depth) + i32::from(delta);
|
|
516
|
+
// Stack depth shouldn't go negative (indicates compiler bug)
|
|
517
|
+
debug_assert!(new_depth >= 0, "Stack depth went negative: {new_depth}");
|
|
518
|
+
// Safe cast: new_depth is non-negative and stack won't exceed u16::MAX in practice
|
|
519
|
+
self.current_stack_depth = u16::try_from(new_depth.max(0)).unwrap_or(u16::MAX);
|
|
520
|
+
self.max_stack_depth = self.max_stack_depth.max(self.current_stack_depth);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/// Tracks stack effect for opcodes with u8 operand.
|
|
524
|
+
///
|
|
525
|
+
/// For opcodes with variable effects (like `CallFunction`, `BuildList`),
|
|
526
|
+
/// calculates the effect based on the operand.
|
|
527
|
+
fn track_stack_effect_u8(&mut self, op: Opcode, operand: u8) {
|
|
528
|
+
let effect: i16 = match op {
|
|
529
|
+
// CallFunction pops (callable + args), pushes result: -(1 + arg_count) + 1 = -arg_count
|
|
530
|
+
Opcode::CallFunction => -i16::from(operand),
|
|
531
|
+
// UnpackSequence pops 1, pushes n: n - 1
|
|
532
|
+
Opcode::UnpackSequence => i16::from(operand) - 1,
|
|
533
|
+
// ListAppend/SetAdd pop value: -1 (depth operand doesn't affect stack count)
|
|
534
|
+
Opcode::ListAppend | Opcode::SetAdd => -1,
|
|
535
|
+
// DictSetItem pops key and value: -2
|
|
536
|
+
Opcode::DictSetItem => -2,
|
|
537
|
+
// Default: use fixed effect if available
|
|
538
|
+
_ => op.stack_effect().unwrap_or(0),
|
|
539
|
+
};
|
|
540
|
+
self.adjust_stack(effect);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/// Tracks stack effect for opcodes with u16 operand.
|
|
544
|
+
///
|
|
545
|
+
/// For opcodes with variable effects (like `BuildList`, `BuildTuple`),
|
|
546
|
+
/// calculates the effect based on the operand.
|
|
547
|
+
fn track_stack_effect_u16(&mut self, op: Opcode, operand: u16) {
|
|
548
|
+
// Safe cast: operand won't exceed i16::MAX in practice (would be a huge list)
|
|
549
|
+
let operand_i16 = operand.cast_signed();
|
|
550
|
+
let effect: i16 = match op {
|
|
551
|
+
// BuildList/BuildTuple/BuildSet: pop n, push 1: -(n - 1) = 1 - n
|
|
552
|
+
Opcode::BuildList | Opcode::BuildTuple | Opcode::BuildSet => 1 - operand_i16,
|
|
553
|
+
// BuildDict: pop 2n (key-value pairs), push 1: 1 - 2n
|
|
554
|
+
Opcode::BuildDict => 1 - 2 * operand_i16,
|
|
555
|
+
// BuildFString: pop n parts, push 1: 1 - n
|
|
556
|
+
Opcode::BuildFString => 1 - operand_i16,
|
|
557
|
+
// Default: use fixed effect if available
|
|
558
|
+
_ => op.stack_effect().unwrap_or(0),
|
|
559
|
+
};
|
|
560
|
+
self.adjust_stack(effect);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/// Manually adjust stack depth for complex scenarios.
|
|
564
|
+
///
|
|
565
|
+
/// Use this when the compiler knows the exact stack effect that can't
|
|
566
|
+
/// be determined from the opcode alone (e.g., exception handlers pushing
|
|
567
|
+
/// an exception value).
|
|
568
|
+
pub fn adjust_stack_depth(&mut self, delta: i16) {
|
|
569
|
+
self.adjust_stack(delta);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/// Label for a forward jump that needs patching.
|
|
574
|
+
///
|
|
575
|
+
/// Stores the bytecode offset where the jump instruction was emitted.
|
|
576
|
+
/// Pass this to `patch_jump()` once the target location is known.
|
|
577
|
+
#[derive(Debug, Clone, Copy)]
|
|
578
|
+
pub struct JumpLabel(usize);
|
|
579
|
+
|
|
580
|
+
#[cfg(test)]
|
|
581
|
+
mod tests {
|
|
582
|
+
use super::*;
|
|
583
|
+
|
|
584
|
+
#[test]
|
|
585
|
+
fn test_emit_basic() {
|
|
586
|
+
let mut builder = CodeBuilder::new();
|
|
587
|
+
builder.emit(Opcode::LoadNone);
|
|
588
|
+
builder.emit(Opcode::Pop);
|
|
589
|
+
|
|
590
|
+
let code = builder.build(0);
|
|
591
|
+
assert_eq!(code.bytecode(), &[Opcode::LoadNone as u8, Opcode::Pop as u8]);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
#[test]
|
|
595
|
+
fn test_emit_u8_operand() {
|
|
596
|
+
let mut builder = CodeBuilder::new();
|
|
597
|
+
builder.emit_u8(Opcode::LoadLocal, 42);
|
|
598
|
+
|
|
599
|
+
let code = builder.build(0);
|
|
600
|
+
assert_eq!(code.bytecode(), &[Opcode::LoadLocal as u8, 42]);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
#[test]
|
|
604
|
+
fn test_emit_u16_operand() {
|
|
605
|
+
let mut builder = CodeBuilder::new();
|
|
606
|
+
builder.emit_u16(Opcode::LoadConst, 0x1234);
|
|
607
|
+
|
|
608
|
+
let code = builder.build(0);
|
|
609
|
+
assert_eq!(code.bytecode(), &[Opcode::LoadConst as u8, 0x34, 0x12]);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
#[test]
|
|
613
|
+
fn test_forward_jump() {
|
|
614
|
+
let mut builder = CodeBuilder::new();
|
|
615
|
+
let jump = builder.emit_jump(Opcode::Jump);
|
|
616
|
+
builder.emit(Opcode::LoadNone); // 1 byte, skipped by jump
|
|
617
|
+
builder.emit(Opcode::LoadNone); // 1 byte, skipped by jump
|
|
618
|
+
builder.patch_jump(jump);
|
|
619
|
+
builder.emit(Opcode::LoadNone); // Return value
|
|
620
|
+
builder.emit(Opcode::ReturnValue);
|
|
621
|
+
|
|
622
|
+
let code = builder.build(0);
|
|
623
|
+
// Jump at offset 0, target at offset 5 (after 2x LoadNone)
|
|
624
|
+
// Offset = 5 - 0 - 3 = 2
|
|
625
|
+
assert_eq!(
|
|
626
|
+
code.bytecode(),
|
|
627
|
+
&[
|
|
628
|
+
Opcode::Jump as u8,
|
|
629
|
+
2,
|
|
630
|
+
0, // i16 little-endian = 2
|
|
631
|
+
Opcode::LoadNone as u8,
|
|
632
|
+
Opcode::LoadNone as u8,
|
|
633
|
+
Opcode::LoadNone as u8,
|
|
634
|
+
Opcode::ReturnValue as u8,
|
|
635
|
+
]
|
|
636
|
+
);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
#[test]
|
|
640
|
+
fn test_backward_jump() {
|
|
641
|
+
let mut builder = CodeBuilder::new();
|
|
642
|
+
let loop_start = builder.current_offset();
|
|
643
|
+
builder.emit(Opcode::LoadNone); // offset 0, 1 byte
|
|
644
|
+
builder.emit(Opcode::Pop); // offset 1, 1 byte
|
|
645
|
+
builder.emit_jump_to(Opcode::Jump, loop_start); // offset 2, target 0
|
|
646
|
+
|
|
647
|
+
let code = builder.build(0);
|
|
648
|
+
// Jump at offset 2, target at offset 0
|
|
649
|
+
// Offset = 0 - (2 + 3) = -5
|
|
650
|
+
let expected_offset = (-5i16).to_le_bytes();
|
|
651
|
+
assert_eq!(
|
|
652
|
+
code.bytecode(),
|
|
653
|
+
&[
|
|
654
|
+
Opcode::LoadNone as u8,
|
|
655
|
+
Opcode::Pop as u8,
|
|
656
|
+
Opcode::Jump as u8,
|
|
657
|
+
expected_offset[0],
|
|
658
|
+
expected_offset[1],
|
|
659
|
+
]
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
#[test]
|
|
664
|
+
fn test_load_local_specialization() {
|
|
665
|
+
let mut builder = CodeBuilder::new();
|
|
666
|
+
builder.emit_load_local(0);
|
|
667
|
+
builder.emit_load_local(1);
|
|
668
|
+
builder.emit_load_local(2);
|
|
669
|
+
builder.emit_load_local(3);
|
|
670
|
+
builder.emit_load_local(4);
|
|
671
|
+
builder.emit_load_local(256);
|
|
672
|
+
|
|
673
|
+
let code = builder.build(0);
|
|
674
|
+
assert_eq!(
|
|
675
|
+
code.bytecode(),
|
|
676
|
+
&[
|
|
677
|
+
Opcode::LoadLocal0 as u8,
|
|
678
|
+
Opcode::LoadLocal1 as u8,
|
|
679
|
+
Opcode::LoadLocal2 as u8,
|
|
680
|
+
Opcode::LoadLocal3 as u8,
|
|
681
|
+
Opcode::LoadLocal as u8,
|
|
682
|
+
4,
|
|
683
|
+
Opcode::LoadLocalW as u8,
|
|
684
|
+
0,
|
|
685
|
+
1, // 256 in little-endian
|
|
686
|
+
]
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
#[test]
|
|
691
|
+
fn test_add_const() {
|
|
692
|
+
let mut builder = CodeBuilder::new();
|
|
693
|
+
let idx1 = builder.add_const(Value::Int(42));
|
|
694
|
+
let idx2 = builder.add_const(Value::None);
|
|
695
|
+
|
|
696
|
+
assert_eq!(idx1, 0);
|
|
697
|
+
assert_eq!(idx2, 1);
|
|
698
|
+
}
|
|
699
|
+
}
|