Skip to content

Change pythonToLaurel and pythonToCore to take Array stmt#645

Merged
joehendrix merged 2 commits intomainfrom
jhx/pythontolaurel_array_stmt
Mar 25, 2026
Merged

Change pythonToLaurel and pythonToCore to take Array stmt#645
joehendrix merged 2 commits intomainfrom
jhx/pythontolaurel_array_stmt

Conversation

@joehendrix
Copy link
Copy Markdown
Contributor

@joehendrix joehendrix commented Mar 24, 2026

Accept an Array of Python statements instead of a Command/Program wrapper so callers control how modules are unwrapped. This removes the hidden assumption that translation always starts from a single Module command and makes the API more composable for upcoming pipeline changes.

  • pythonToLaurel' and pythonToLaurel now take Array (stmt SourceRange) instead of Python.Command SourceRange, eliminating the internal match on Module and the dead | _ => throw branch.
  • pythonToCore now takes Array (stmt SourceRange) instead of Strata.Program; the toPyCommands and unwrapModule helpers are removed from PythonToCore.lean.
  • signaturesToLaurel modulePrefix parameter is now required (no default) so callers explicitly choose the right prefix rather than silently getting "".
  • Unwrapping logic moves to call sites (StrataMain, PySpecPipeline, IdentifyOverloadsTest) where the module structure context is clear.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@joehendrix joehendrix force-pushed the jhx/pythontolaurel_array_stmt branch from 9685c55 to ea6d9ff Compare March 24, 2026 06:06
@joehendrix joehendrix changed the base branch from main to jhx/move_overload_table March 24, 2026 06:06
Base automatically changed from jhx/move_overload_table to main March 24, 2026 14:24
@joehendrix joehendrix force-pushed the jhx/pythontolaurel_array_stmt branch 6 times, most recently from 4ea02a9 to 73c3b63 Compare March 24, 2026 17:26
@joehendrix joehendrix marked this pull request as ready for review March 24, 2026 20:42
@joehendrix joehendrix requested a review from a team March 24, 2026 20:42
@joehendrix joehendrix force-pushed the jhx/pythontolaurel_array_stmt branch 2 times, most recently from 085e2e5 to 7ab67c5 Compare March 24, 2026 21:01
Accept an Array of Python statements instead of a Command/Program
wrapper so callers control how modules are unwrapped. This removes
the assumption that translation always starts from a single Module
command and makes the API more composable.

- pythonToLaurel' and pythonToLaurel now take Array (stmt SourceRange)
  instead of Python.Command SourceRange
- pythonToCore now takes Array (stmt SourceRange) instead of
  Strata.Program; remove toPyCommands and unwrapModule from PythonToCore
- signaturesToLaurel modulePrefix parameter is now required (no default)
  to ensure callers explicitly choose the right prefix
- Move toPyCommands/unwrapModule to call sites (StrataMain, PySpecPipeline,
  IdentifyOverloadsTest) where the unwrapping context is clear

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@shigoel shigoel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a question. Not blocking.

@joehendrix joehendrix added this pull request to the merge queue Mar 25, 2026
Merged via the queue into main with commit 95bec8d Mar 25, 2026
15 checks passed
@joehendrix joehendrix deleted the jhx/pythontolaurel_array_stmt branch March 25, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants