Skip to content

Support lambda types in union types - #118

Merged
liufengyun merged 15 commits into
mainfrom
union
Sep 18, 2026
Merged

liufengyun merged 15 commits into
mainfrom
union

Conversation

@liufengyun

@liufengyun liufengyun commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Support lambda types in union types

Summary

Now a union type like Int | (Int => Int) is valid. Only one lambda type may appear in a union type, similar to the restrict that only one branch may be numeric.

Checklist

  • Added / updated tests under tests/pos/ or tests/warn/
  • Docs updated if the change affects user-visible behavior
  • All commits are signed off (why?)
How to sign off commits

Use git commit -s to add the Signed-off-by line automatically:

To add a sign-off to the last commit retroactively:

git commit --amend -s --no-edit

To add sign-off to the last 3 commits:

git rebase --signoff HEAD~3

Security impact

No

Compatibility impact

  • Source compatibility: existing code continue to compile
  • SAST compatibility
    • forward compatibility: new libraries can be used by old compiler
    • backward comopatibility: old libraries can be used by new compiler
  • Standard Library compatibility:
    • forward compatibility: new code can work with old stdlib
    • backward compatibility: old code work with the new stdlib
  • Runtime Library compatibility:
    • forward compatibility: new code can work with old runtime
    • backward compatibility: old code work with the new runtime
  • Build tool
    • Build spec compatibility: old projects continue to build
    • Joy package compatibility: old .joy can be consumed by new build tool

Implementation checklist (for new language features)

Expand
  • specify syntax (syntax-summary.md)
  • token & scanner
  • ast & parsing syntax
  • sast
    • sast & sast operations
    • raw printer and pickling test
    • flags & symbols & name table
    • types & type operations
    • subtyping
    • encoding & decoding
  • type checking
    • namer
    • expression typer
    • flow typer
    • view checker
    • adaptation
    • auto resolution
  • context params
    • analysis and check
    • semantic transform
  • pattern match
    • pattern typer
    • flow typing
    • determinism check
    • exhaustivity check
    • semantic transform
  • phases
    • closure conversion
    • tail-rec optimization
    • erasure
  • platforms
    • interpreter
    • js backend
    • ruby backend
    • python backend
    • stack machine
    • register machine
  • tools
    • emacs
    • vscode
    • vim
    • js code highlight
  • documentation
    • design doc
  • tests
    • positive tests
    • negative tests

Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Signed-off-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
Comment thread docs/jips/0004-lambda-union-branch.md Outdated
Co-authored-by: Fengyun Liu <fengyun.liu.cs@gmail.com>
@liufengyun
liufengyun merged commit 8054555 into main Sep 18, 2026
3 checks passed
@liufengyun
liufengyun deleted the union branch September 18, 2026 22:51
@liufengyun liufengyun mentioned this pull request Sep 19, 2026
3 tasks
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.

2 participants