-
Notifications
You must be signed in to change notification settings - Fork 20
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
Calling newColumnView() does not compile. #206
Comments
type
A = ref object
impl: pointer
i: int
B = ref object
impl: pointer
j: int
#proc t(x: A = nil) = # works
proc t(x: A | B = A(nil)) =
echo(if x == nil: "nil" else: $(cast[int](x.impl)))
proc main =
var h: A
t() # Error: cannot instantiate: 'T'
t(h) # works
t(x = B(nil)) # Error: undeclared field: 'impl'
main() Solves the latter issue. What you may want is: proc t(x: A | B) =
echo(if x == nil: "nil" else: $(cast[int](x.impl)))
proc t(x: typedesc[A | B]) =
t(default(x))
# The folllowing can be used for the `nil` case.
t(A)
t(B) |
Well, should be fixed, try
|
StefanSalewski
added a commit
that referenced
this issue
Sep 24, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: