Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any reason to still allow unit fragments in scala 3? #249

Open
benediktwerner opened this issue Nov 28, 2022 · 1 comment
Open

Any reason to still allow unit fragments in scala 3? #249

benediktwerner opened this issue Nov 28, 2022 · 1 comment

Comments

@benediktwerner
Copy link

In Scala 3, if without an else always evaluates to Unit. This means code like div(if (cond) h1("a"), ...) now never produces anything, even if the conditions is true, which has lead to a few silent issues when we transitioned to Scala 3 where stuff suddenly wasn't rendered anymore. Are there any other reasons to keep allowing units in templates? If not, it seems better to disallow this now to avoid mistakes like this?

niklasf added a commit to niklasf/scalatags that referenced this issue Dec 27, 2022
Prevents accidentally using if without else in Scala 3, which now always
evaluates to `()`.
@bwbecker
Copy link

Agreed. Just got bit by this myself.

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

No branches or pull requests

2 participants