Skip to content

feat: bidirectional refactor #1#34

Merged
R-unic merged 7 commits into
R-unic:masterfrom
jackprogramsjp:master
Jul 16, 2026
Merged

feat: bidirectional refactor #1#34
R-unic merged 7 commits into
R-unic:masterfrom
jackprogramsjp:master

Conversation

@jackprogramsjp

@jackprogramsjp jackprogramsjp commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Plan / Implementation

  • Refactor the codebase to also include a top-down approach to implement bidirectional. This allows for better type errors and nicer organization.
  • Check against array literals. This PR can be extended more, but this will just be the starting point. More can be added. The point is to gradually refactor, rather than rewrite everything at once.

Some Tests have already passed without bidirectional.

Current Steps

  • Check array literals against expected T[] for each element
  • When a function has a declared return type, the return value should be checked against that type.

Test plan

  • dotnet test should show all green
  • Add any other possible tests that may pop up during implementation.

@jackprogramsjp jackprogramsjp changed the title WIP: bidirectional refactor, and inference for array literal checking WIP: bidirectional refactor, and inference for all literals Jul 16, 2026
@jackprogramsjp

Copy link
Copy Markdown
Contributor Author

Ready to get reviewed for merge.

Changes

  1. More special cases are expected to be added later as well, but for now, array literals.
  2. For a type annotated let, when there's initialization, goes through checking against declared type.
  3. Return expression is also checked against return type when present.
  4. Non-generic call arguments are checked.
  5. Assignments are checked
  6. Expression bodied functions checked
  7. Interface properties and index initializers checked
  8. Generic calls checked (explicit ::<T> and inferred)
  9. Inference order
  10. GetContextualType fix (has to read ColonTypeClause.Type, not clause.

@jackprogramsjp
jackprogramsjp marked this pull request as ready for review July 16, 2026 18:49
@jackprogramsjp jackprogramsjp changed the title WIP: bidirectional refactor, and inference for all literals WIP: bidirectional refactor #1 Jul 16, 2026
@jackprogramsjp jackprogramsjp changed the title WIP: bidirectional refactor #1 feat: bidirectional refactor #1 Jul 16, 2026
@R-unic
R-unic merged commit ac20396 into R-unic:master Jul 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants