Skip to content

Add assert macro to built-in-macros#164

Merged
borkdude merged 1 commit intosquint-cljs:mainfrom
willcohen:assert
Nov 17, 2025
Merged

Add assert macro to built-in-macros#164
borkdude merged 1 commit intosquint-cljs:mainfrom
willcohen:assert

Conversation

@willcohen
Copy link
Copy Markdown
Contributor

@willcohen willcohen commented Nov 14, 2025

Cherry was missing the 'assert entry in built-in-macros, causing (assert ...) to compile as assert.call() without any import, leading to 'assert is not defined' runtime errors.

This adds 'assert squint-macros/core-assert to match Squint's implementation, which properly expands assertions to (when-not x (throw ...)) instead of function calls.

Fixes compilation of assert in ES modules and browsers where no global assert exists.

Please answer the following questions and leave the below in as part of your PR.

@willcohen willcohen force-pushed the assert branch 3 times, most recently from ce8b853 to 49dcdb4 Compare November 15, 2025 16:31
@willcohen
Copy link
Copy Markdown
Contributor Author

I amended #166 to have this changelog entry to avoid conflicts on main

@willcohen willcohen marked this pull request as draft November 16, 2025 01:13
@willcohen
Copy link
Copy Markdown
Contributor Author

Tests are totally wrong -- I didn't actually compare them to the test suite format. Need to redo.

@willcohen willcohen marked this pull request as ready for review November 16, 2025 15:11
@willcohen
Copy link
Copy Markdown
Contributor Author

Tests now added correctly to test suite.

@borkdude
Copy link
Copy Markdown
Member

This may not work the way you think it works. The tests run in CLJS, not in cherry. See the cherry.compiler-test for example.
This PR just tests CLJS's assert.

@willcohen
Copy link
Copy Markdown
Contributor Author

Added assert to macros, simple test added to compiler test. Removed the superfluous junk.

@borkdude borkdude merged commit 533a88a into squint-cljs:main Nov 17, 2025
2 checks passed
@borkdude
Copy link
Copy Markdown
Member

Oh wait, this was missing, although you did check that box:

-I have updated the CHANGELOG.md file with a description of the addressed issue.

Can you add that in a new PR?

@willcohen willcohen mentioned this pull request Nov 17, 2025
1 task
@willcohen willcohen deleted the assert branch November 17, 2025 18:30
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