Skip to content

Old pony 5279#173

Merged
IgorDeepakM merged 15 commits into
masterfrom
old_pony_5279
May 10, 2026
Merged

Old pony 5279#173
IgorDeepakM merged 15 commits into
masterfrom
old_pony_5279

Conversation

@IgorDeepakM
Copy link
Copy Markdown
Owner

No description provided.

SeanTAllen and others added 15 commits May 10, 2026 21:43
…tters (#5309)

HoverFormatter, SignatureHelp, and _TypeFormatter all accepted a Channel
argument that was threaded through every internal function but never used.
Remove it from all signatures and update the two call sites in
workspace_manager.pony.
Two bugs:
- ponylang/ponyc#1216 -- `interface Iter[A] fun enum[B](): Iter[(B, A)]
  => this` hangs the compiler indefinitely.
- ponylang/ponyc#3930 -- `fun flatten[A: Array[Array[A]] #read](...)`
  crashes the compiler with a stack overflow.

`exact_nominal` in src/libponyc/type/subtype.c compared typeargs via
`is_eq_typeargs`, which calls `is_eqtype` -> `is_subtype` -> back into
`check_assume` on the same recursive shapes. The re-entry stack-
overflowed on #3930 and produced residual exponential fan-out that
made the SAME_DEF_LIMIT divergence guard unreachable in practice for

The fix replaces `is_eq_typeargs` in `exact_nominal` with a structural
AST equality function (`exact_type`) that compares definition pointers
(`ast_data`) for nominals, type parameter references, and type alias
references, and walks children for compound forms. It does not call
back into the subtype machinery, so the recursion characteristics are
preserved while correctly distinguishing typeparams that share a source
name across scopes.

A new SAME_DEF_LIMIT divergence guard in `is_nominal_sub_nominal`
bounds the depth of any single drifting recursion chain. K = 4 was
chosen empirically -- K = 2 was refuted by pony_check shapes that need
more drifting rounds to converge. Bidirectional coupling comments on
subtype.c and packages/pony_check/generator.pony record the validation
procedure.

The conceptual fix -- avoiding re-entry from `exact_nominal` into the
subtype machinery -- was originally authored by Red Davies on branch
`origin/issue_3930`. An earlier iteration of this PR used
`ast_print_type` string comparison; jemc's review identified that as
unsound (the printer collapses typeparams sharing a source name across
scopes), and the structural AST equality version replaced it.

Also adds project-level regression guard tests for three related
shapes (#5198, #2399, #2562) that already terminate cleanly on main
without this PR's changes -- kept as guards against the shapes being
broken again by future work. Those issues are closed separately as
already-fixed.

Closes #1216
Closes #3930
…312)

Remove keyword: String parameter from extract_method_info in pony-lsp

extract_method_info was dispatching on string comparison ("fun", "be",
"new") to decide whether to extract a return type. Since ast is already
a parameter, derive the token ID from ast.id() inside the function and
compare against TokenIds constants instead.

An unrecognised token ID now returns None rather than silently producing
a malformed MethodInfo.
…ors in pony-lsp (#5313)

Following the same pattern as extract_method_info, remove the keyword:
String parameter from extract_entity_info, _extract_field_info, and
_extract_local_var_info. Each function now derives its keyword from
ast.id() via a match expression internally.

An unrecognised token ID returns None rather than silently producing a
malformed info object.
Behaviour return types are always `None val` inserted by the sugar pass
and are not writable by the user (adding `: None` to a `be` definition
is a compile error). Displaying them in hover creates noise without
conveying useful information.
Replaces US spellings (serialize, initialize/initialization, behavior/behaviors)
with British equivalents in prose that is not constrained by the LSP protocol.
Class fields can carry docstrings per the Pony grammar. Hovering over a
field now includes the docstring below the declaration, consistent with
how entity and method hover already behave.
Three Windows-only `try` blocks on the IOCP write/completion path swallowed
errors silently because they had no `else` arm. When an IOCP write failed
or completion bookkeeping went inconsistent, the connection didn't close;
queued bytes piled up on a dead socket. The POSIX sibling already handled
the same condition with `else hard_close()` and a "Non-graceful shutdown on
error." comment — the Windows path was the missing-`else` outlier.

Adds the same `else hard_close()` arm to all three sites (`writev`,
`write_final`, `_complete_writes`). The third site also needs an explicit
`return` to skip the post-try `_release_backpressure()` call — without it,
`unthrottled` would fire on the user's notify after `closed`, matching
neither POSIX behavior nor the function's own `len == 0` early-return
pattern.

Updates docstrings on `writev` and `_complete_writes` to mention the
on-error close behavior. `write_final`'s docstring already promised it.

Closes #5287
@IgorDeepakM IgorDeepakM merged commit 7d2ba52 into master May 10, 2026
3 of 4 checks passed
@IgorDeepakM IgorDeepakM deleted the old_pony_5279 branch May 12, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants