Commit 8690547
PR requested and agreed on by @olivier-aws
## Summary
The Laurel `print` procedure declaration in
`PythonRuntimeLaurelPart.lean` was missing the `opt` parameter that
models Python's variadic `*objects`. Without it, a call like `print("a",
"b")` would be handled differently in the Laurel path vs the Core path,
since positional arguments would shift.
## Changes
1. **`Strata/Languages/Python/PythonRuntimeLaurelPart.lean`** — Added
`opt : Any` parameter to the `print` declaration, matching the Core
declaration's parameter list:
```
// Before
procedure print(msg : Any, sep : Any, end : Any, file : Any, flush :
Any) returns ();
// After
procedure print(msg : Any, opt : Any, sep : Any, end : Any, file : Any,
flush : Any) returns ();
```
2. **`StrataTest/Languages/Python/VerifyPythonTest.lean`** — Added a
test exercising `print` with multiple positional arguments (`print()`,
`print("a")`, `print("a", "b")`, `print("a", "b", "c")`) and
combinations with keyword arguments (`sep`, `end`, `flush`).
Per @olivier-aws's guidance, the parameter types are kept as `Any` (not
changed to match Core's `StrOrNone`/`BoolOrNone`/`AnyOrNone`).
Both the source and test files build successfully with `lake build`.
Fixes #941
---------
Co-authored-by: keyboardDrummer-bot <keyboardDrummer-bot@users.noreply.github.com>
Co-authored-by: Shilpi Goel <shigoel@gmail.com>
Co-authored-by: Fabio Madge <fmadge@amazon.com>
1 parent e39bee1 commit 8690547
3 files changed
Lines changed: 18 additions & 2 deletions
File tree
- StrataTest/Languages/Python
- expected_laurel
- Strata/Languages/Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1073 | 1073 | | |
1074 | 1074 | | |
1075 | 1075 | | |
1076 | | - | |
| 1076 | + | |
1077 | 1077 | | |
1078 | 1078 | | |
1079 | 1079 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
508 | 524 | | |
509 | 525 | | |
510 | 526 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
0 commit comments