-
Notifications
You must be signed in to change notification settings - Fork 2
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
truthy
on nillable types does not produce the correct results
#2
Comments
truthy
on ref/ptr types does produce the correct resultstruthy
on ref/ptr types does not produce the correct results
truthy
on ref/ptr types does not produce the correct resultstruthy
on nillable types does not produce the correct results
fixed |
I think we still need the old version too otherwise the array test won't pass. Line 31 in c9e74b3
That should say not empty array since a seq literal needs an But if you put: template truthy*[T](val: T): bool = not compiles(val.isNil()) Back then |
done - and updated tests |
cool, created a PR to clean up things based on a forum response from Hlaaftana. https://forum.nim-lang.org/t/8806#57402 |
good stuff - merged and ive added some extra tests and fixes for mutable chains like |
I was trying to add condition access support for functions with extra args eg |
https://play.nim-lang.org/#ix=3MaY
elvis/elvis.nim
Line 19 in 09e536d
The implementation uses
compile
: https://nim-lang.github.io/Nim/system.html#compiles%2Cuntyped, which always returns true if val is a nillable type, but we want to actually checknot val.isNil
at runtime.This will produce the expected results for nillable types.
The text was updated successfully, but these errors were encountered: