An inline object type on a parameter or local is emitted as TypeScript text
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend-api-design, compilers
Research direction
Start by reading the lowering paths that emit types and object literals for the Dafny and Lean backends, then find the tests covering synthetic names for interface fields and return types. Add regression coverage for the sumA parameter and mk local annotation; the issue is done when both examples either resolve on both backends or produce an lsc error naming the inline type.
Written by the indexing model from the issue text.
Description
Problem
SPEC.md says anonymous object types in interface fields and in function return types get synthetic datatype names (SpecEntryDecision, ParseSpecYamlResult). The same type written on a parameter or a local variable gets no name. Both backends emit the TypeScript spelling as a type name, and the generated files do not parse.
Reproduced on upstream main at 36eb31d (LemmaScript 0.6.8).
Reproduction
export function sumA(p: { x: number; y: number }): number {
return p.x + p.y;
}
export function mk(n: number): number {
const r: { k: number } = { k: n };
return r.k;
}
lsc gen --backend=dafny emits:
type { x: number; y: number }(==)
function sumA(p: { x: number; y: number }): int
{
(p.x + p.y)
}
function mk(n: int): int
{
var r := (n);
r.k
}
dafny resolve stops at the first line with invalid Ident. mk also lowers the record literal to (n), which has no field k.
lsc gen --backend=lean emits opaque { x: number; y: number } : Type and def sumA (p : { x: number; y: number }) : Int, and lowers the literal to let r := { k := n }.
A named alias, type Pt = { x: number; y: number }, works in the parameter position.
Expected
Either the parameter and local positions get synthetic names, as interface fields and return types do (for example SumAP and MkR), or lsc rejects an inline object type in those positions with a message that suggests a named alias. Both backends fail loudly today, so no false proof results; the cost is valid TypeScript that does not compile and an error message that points at generated text.
Acceptance criteria
sumAandmkabove either generate code that resolves on both backends or are rejected bylscwith an error naming the inline type.- A regression test covers an inline object type on a parameter and on a local annotation.
- Dominant language
- TypeScript
- Stars
- 113
- Forks
- 13
- Avg merge
- 15h 35m
- Merged PRs (30d)
- 56
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from midspiral/LemmaScript
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
midspiral/LemmaScript#355 · 1 comment ·
Maintainers usually reply within 1 day
-
In a pure function body, a `const` declared inside an `if` branch stays in scope after the `if`, so a false `ensures` can verifyPossibly taken @namin claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
midspiral/LemmaScript#362 ·
Maintainers usually reply within 1 day
-
A `const` or `let` inside a bare `{ }` block stays in scope after the block, so a false `ensures` can verifyPossibly taken @namin claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 15/100
midspiral/LemmaScript#361 ·
Maintainers usually reply within 1 day
-
A closure declared before a same-name `const` or `let` in its block reads the outer variable, so a false `ensures` can verifyPossibly taken @namin claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 18/100
midspiral/LemmaScript#360 ·
Maintainers usually reply within 1 day
-
An assignment used as an expression, such as `(x = 7);` or `const y = (x = 7)`, is extracted as an equality test, so a false `ensures` can verifyPossibly taken @namin claimed this today. Open
Difficulty 3/5 Half a day Newbie friendliness 30/100
midspiral/LemmaScript#356 · 1 reaction ·
Maintainers usually reply within 1 day
All issues in midspiral/LemmaScript
Similar issues
-
bug done
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
neavo/LinguaGacha#1124 ·
Maintainers usually reply within 1 day
-
[fullsend] E2E: backstage-microsoft-auth — catalogQuery missing error handler for network errorsPossibly taken @fullsend-ai-coder claimed this today. Opene2e-failure ready-to-code
Difficulty 2/5 Under an hour Newbie friendliness 78/100
redhat-developer/rhdh-plugin-export-overlays#4821 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
brylie/mission-island#225 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google-gemini/gemini-cli#30412 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day