Skip to content

fix(analyser): keep promised types true for pops, maps and Any indexes 🩹 - #316

Merged
timfennis merged 1 commit into
feat/type-checkerfrom
fix/codex-291-findings
Nov 13, 2026
Merged

timfennis merged 1 commit into
feat/type-checkerfrom
fix/codex-291-findings

Conversation

@timfennis

Copy link
Copy Markdown
Owner

Fixes the review findings still open on the type checker PR (#291): places where a type the analyser promised didn't match the value the program gets, so a later call could pick the wrong overload.

Behaviour changes:

  • pop and pop_left on an empty list are an error, as pop on a deque or heap already is, since their return type promises an element. pop? and pop_left? return None instead.
  • A list write with an index of type Any checks the value: xs[i] = "bad" on a List<Int> is an analysis error, and x["foo"] = 69 is one too, where it failed at runtime with "Invalid list index" before. An Any index still picks between the element and the range overload as the program runs.

Bug fixes:

  • A map comprehension's default is one of the map's values: %{:"missing", x: x for x in xs} holds Strings as well as Ints.
  • A map literal key without a value holds (): %{"a", "b": 1} holds () as well as Ints.
  • The catch-all []=(List<T>, Any, Any) overload is gone. Calls the program picks the overload of as it runs keep only the overloads that take the arguments with each type parameter one type, as early picks already did, so []=(List<T>, Int, T) no longer looks like it takes a String for a List<Int>. Operators, which may apply to each element of a tuple, and function arguments, whose types aren't checked as the program runs, are left out of that check.
  • Runtime dispatch matches () as cheaply as a scalar, and any iterator conforms to an Iterator<T>, since its elements can't be checked without consuming it.

🤖 Generated with Claude Code

https://claude.ai/code/session_015rQP9SKVmpvME4F2LXeWmG

…s and Any indexes 🩹

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rQP9SKVmpvME4F2LXeWmG
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T09:00:25.538759Z 6208d94 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@timfennis
timfennis merged commit 1b4b44f into feat/type-checker Nov 13, 2026
1 check passed
@timfennis
timfennis deleted the fix/codex-291-findings branch November 13, 2026 09: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.

1 participant