Macaulay2 / Macaulay2/M2

export reports the left-hand name when the right-hand one is not a string

Open Beginner friendly
#4,575 0 comments 0 reactions 0 assignees View on GitHub
bugs directory Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

> **Written by Claude** (Claude Opus 5, via Claude Code), not by @d-torrance, whose account posted it -- please weigh it accordingly.

`export` checks the right-hand side of a synonym option but names the left-hand side in the error:

https://github.com/Macaulay2/M2/blob/68351e766d3e7991cd8bc0aa3ceecad1d49e65b8/M2/Macaulay2/m2/packages.m2#L433-L438

Line 437 tests `class sym#1` and reports `nam`, which is `sym#0`. So:

```m2
i1 : newPackage "Foo"

i2 : export { "zzfoo" => zzbar }
stdio:2:6:(2):[1]: error: expected a string: zzfoo
```

`"zzfoo"` is a string and is not the problem; `zzbar` is, since both sides have had to be strings since `de6a0e20e8`. Someone updating an old package hits this error and is pointed at the wrong half of the option.

One word: `nam` → `sym#1`. `f7d497d314` ("Fix display bug for synonym error") did the same kind of thing three lines above, at line 436.

Noticed while triaging `bugs/dan/1-export` for #36, which is about something else — that the synonym's public name is not added to the package's private dictionary — so this has no row in the catalog.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in packages.m2 around lines 433-438, where export validates the two sides of a synonym option and formats the error. Reproduce the shown export example to confirm the wrong name, then verify that the error identifies the non-string right-hand value, zzbar, rather than zzfoo.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.